Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要将 anIList转换为Collection( System.Collections.ObjectModel)
IList
Collection
System.Collections.ObjectModel
你怎么办?
Collection<MyClass> coll = new Collection<MyClass>(myIList);
只需使用构造函数:
IList<T> myList = ... System.Collections.ObjectModel.Collection<T> omc = new System.Collections.ObjectModel.Collection<T>(myList);