[Mono-list] How to make a derived method "non-public"

Fergus Henderson fjh@cs.mu.oz.au
Sun, 5 Aug 2001 14:44:25 +1000


On 05-Aug-2001, Nick Drochak <ndrochak@gol.com> wrote:
> I am working on System.Collections.CollectionBase.  I noticed from the MS
> documentation (on MSDN [1]) that they show Clear() and RemoveAt() as public
> members of the class.  However, the other members from IList [2] are not.
> 
> I don't know if my question is about C# or the docs, but is it syntactically
> (is that a word?) possible to make some of IList members non-public in my
> class that inherits from it?

Yes, it is.  You just define methods named "IList.Foo", "IList.Bar", etc.
Here's an example (using IHashCodeProvider):

	using System.Collections;
	public class Foo : IHashCodeProvider {
		int IHashCodeProvider.GetHashCode(object obj) {
			return 42;
		}
	}

-- 
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.