的IEnumerable< T> 工具的IEnumerable 但的ICollection< T> 不执行的ICollection
IEnumerable<T> implements IEnumerable. But ICollection<T> does not implement ICollection.
什么是这样做的理由和/或说这只是一个监督?
What was the rationale for this and/or was it just an oversight?
推荐答案正如尼克说,的ICollection 是pretty的无用。
As Nick said, ICollection is pretty much useless.
这些接口都是类似的只有他们的名字, CopyTo从和计数都仅有一个共同的特性。 添加,删除,清除,包含和的IsReadOnly 已被添加,而 IsSychronized 和 SyncRoot上已被删除。
These interfaces are similar only by their name, CopyTo and Count are the only properties in common. Add, Remove, Clear, Contains and IsReadOnly have been added while IsSychronized and SyncRoot have been removed.
在本质上,的ICollection&LT; T&GT; 是可变的,的ICollection 不是
In essence, ICollection<T> is mutable, ICollection is not.
克日什托夫·Cwalina 有更多关于此的主题
的ICollection&LT; T&GT; 看起来的ICollection ,但它实际上是一个非常不同的抽象。我们发现,的ICollection 是不是非常有用。与此同时,我们也没有那么重presented一读的抽象/写非索引集合。 的ICollection&LT; T&GT; 是这样的抽象,你可以说,的ICollection 没有在通用全球的确切相应的对等; 的IEnumerable&LT; T&GT; 是最接近
ICollection<T> seems like ICollection, but it’s actually a very different abstraction. We found that ICollection was not very useful. At the same time, we did not have an abstraction that represented an read/write non-indexed collection. ICollection<T> is such abstraction and you could say that ICollection does not have an exact corresponding peer in the generic world; IEnumerable<T> is the closest.
更多推荐
为什么不ICollection的&LT; T&GT;实现ICollection的?
发布评论