4

我需要将 anIList转换为Collection( System.Collections.ObjectModel)

你怎么办?

4

2 回答 2

8
Collection<MyClass> coll = new Collection<MyClass>(myIList);
于 2010-05-04T14:17:40.170 回答
4

只需使用构造函数:

IList<T> myList = ...
System.Collections.ObjectModel.Collection<T> omc = 
           new System.Collections.ObjectModel.Collection<T>(myList);
于 2010-05-04T14:17:06.597 回答