ICollection is very rarely implemented in custom types because, for syntactic sugar, it's sufficient to implement the Add(TValue item) method with any return type.
-
It's usually very convenient to implement bool Add(TValue item) because its operation is easy to control without having to first use bool Contains(TValue item). Otherwise, you'll encounter exceptions. In any case, this reduces code performance because bool Contains(TValue item) is essentially already implemented in the bool Add(TValue item) method under the hood. You're probably familiar with the slowness of exceptions.
-
Often, validation methods such as CollectionAssert.AreEqual and similar methods don't change anything in collections anyway. Therefore, choosing ICollection as the argument type isn't a good idea. (I assume this was done to support legacy versions of C#.)
ICollection is very rarely implemented in custom types because, for syntactic sugar, it's sufficient to implement the Add(TValue item) method with any return type.
It's usually very convenient to implement bool Add(TValue item) because its operation is easy to control without having to first use bool Contains(TValue item). Otherwise, you'll encounter exceptions. In any case, this reduces code performance because bool Contains(TValue item) is essentially already implemented in the bool Add(TValue item) method under the hood. You're probably familiar with the slowness of exceptions.
Often, validation methods such as CollectionAssert.AreEqual and similar methods don't change anything in collections anyway. Therefore, choosing ICollection as the argument type isn't a good idea. (I assume this was done to support legacy versions of C#.)