oop - Convert IList<Interface> to List<Class> -


list<currentelectionservice> result = new list<currentelectionservice>();     result = oelectionsmanager.getcurrentelectionsbyeid(     employeeid.stringtoguid(), planyear) list<currentelectionservice>;  public class currentelectionservice : icurentelection {    // implement interface fields here } 

the method getcurrentelectionsbyeid returns me ilist<icurentelection> , want cast interface class currentelectionservice, returns null. please help.

why not use linq perform cast

list<currentelectionservice> result = oelectionsmanager.getcurrentelectionsbyeid(     employeeid.stringtoguid(), planyear).cast<currentelectionservice>().tolist(); 

i hope helps.


Comments

Popular posts from this blog

javascript - Unusual behaviour when drawing lots of images onto a large canvas -

how can i manage url using .htaccess in php? -

javascript - Chart.js - setting tooltip z-index -