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?
Collection<MyClass> coll = new Collection<MyClass>(myIList);
Just use the constructor:
IList<T> myList = ...
System.Collections.ObjectModel.Collection<T> omc =
new System.Collections.ObjectModel.Collection<T>(myList);
© 2022 - 2024 — McMap. All rights reserved.