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
Post a Comment