I need to cast an IList to a Collection (System.Collections.ObjectModel)
How do you go about this?
I need to cast an IList to a Collection (System.Collections.ObjectModel)
How do you go about this?
Just use the constructor:
IList<T> myList = ...
System.Collections.ObjectModel.Collection<T> omc =
new System.Collections.ObjectModel.Collection<T>(myList);
Collection<MyClass> coll = new Collection<MyClass>(myIList);