I would like to create a custom collection that implements ICollection.
But I would like not to expose some memebers of ICollection like
If you just want to hide those members from your own collection's interface, you can define them explicitly.
void ICollection.Clear() {
// ...
}
Explicitly defined members are only available if the instance is used through that interface.
YourCollection col1 = new YourCollection();
col1.Clear(); // this is not allowed if clear is defined explicitly
ICollection col2 = new YourCollection();
col2.Clear(); // this will work because col2 is ICollection