【发布时间】:2010-05-04 14:11:39
【问题描述】:
我需要将 IList 转换为 Collection (System.Collections.ObjectModel)
你是怎么做的?
【问题讨论】:
标签: c# collections ilist
我需要将 IList 转换为 Collection (System.Collections.ObjectModel)
你是怎么做的?
【问题讨论】:
标签: c# collections ilist
Collection<MyClass> coll = new Collection<MyClass>(myIList);
【讨论】:
只需使用构造函数:
IList<T> myList = ...
System.Collections.ObjectModel.Collection<T> omc =
new System.Collections.ObjectModel.Collection<T>(myList);
【讨论】: