Why doesn’t ICollection implement ICollection? [duplicate]

As Nick said, ICollection is pretty much useless.

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.

In essence, ICollection<T> is mutable, ICollection is not.

Krzysztof Cwalina has more on this topic

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.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)