c# - when using override on a collection<T> method, base class has ToCollection but derived class doesn't have -


base class:

public virtual collection<string> getpaymentmethods(organization organization)         {   ipaymentservice paymentservice = servicelocator.getpaymentservice();              collection<paymentmethod> paymentmethods = paymentservice.getpaymentmethods(organization.countrycode, organization.languagecode, organization.usertype, appavailabletype.autorenewal);             return paymentmethods.select(p => p.paymentmethodtype).tocollection<string>();         } 

override:

 public override collection<string> getpaymentmethods(organization organization)         {              collection<paymentmethod> paymentmethods = this.paymentservice.getpaymentmethods(organization.countrycode, organization.displaylanguagecode, organization.usertype, appavailabletype.autorenewal);             return paymentmethods.select(p => p.paymentmethodtype).**tocollection**<string>();          } 

in above method ".tocollection" isn't available same base class.getting below error:

'system.collections.generic.ienumerable' not contain definition 'tocollection' , no extension method 'tocollection' accepting first argument of type 'system.collections.generic.ienumerable' found (are missing using directive or assembly reference?)

ienumerable doesn't contains tocollection methods. in base class use extensions methods convert collection. on "uses" registration in base class find necessary namespace should write in derived class.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -