【发布时间】:2012-10-29 23:31:43
【问题描述】:
...或者我可以毫无问题地使用 ICollection 吗?
我的意思是,我不认为 ICollection 是为排序集合设计的,因为这可能会破坏为排序或未排序的 ICollection 对象设计的应用程序,但我不知道。
【问题讨论】:
-
查看SortedDictionary的定义:
public class SortedDictionary<TKey, TValue> : IDictionary<TKey, TValue>, ICollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IDictionary, ICollection, IEnumerable {} -
SortedSet 和SortedList 都继承自
ICollection以及其他一些接口。