I’m creating a specialised proxy class that implements IList<T> and wraps an internal List<T> instance.
List<T> itself implements IList<T>, which declares a member bool IsReadOnly, but when I try to access that member from my own class, I can’t because in List<T>, IsReadOnly is private.
So my question is; if an implementation of an interface requires all implemented members to be public, why does List<T> get to implement IsReadOnly as private and thus deny me access to it?
It implements the interface member explicitly.
http://msdn.microsoft.com/en-us/library/aa288461(VS.71).aspx
Note that this does not make the interface member
private. It’s still available publicly, but only if you look at the object through the interface (with casting).