I have a list of items called them MyObject and they need to convert them to the list of IMyInterface because I I want to add other things which are not MyObject but also implement my interface. I tried it but it does not work. . Any suggestions? try it list & lt; IMyInterface & gt; MyList = myObjectList; // myObjectList is a list & lt; MyObject & gt;
from the list & lt; IMyInterface & gt; L = myList.OfType & lt; IMyInterface & gt; (). ToList ();
No comments:
Post a Comment