title: How to hide (remove) a base class's methods in C#?
body: <p>The essence of the problem is, given a class hierarchy like this:</p>
  
  <pre><code>class A
  {
      protected void MethodToExpose()
      {}
  
      protected void MethodToHide(object param)
      {}
  }
  
  class B : A
  {
      new private void MethodToHide(object param)
      {}
  
      protected void NewMethodInB()
      {}
  }
  
  class C : B
  {
      public void DoSomething()
      {
          base.MethodToHide("the parameter"); // This still calls A.MethodToHide()
          base.MethodToExpose(); // This calls A.MethodToExpose(), but that's ok
          base.NewMethodInB();
      }
  }
  </code></pre>
  
  <p>How can I prevent any classes that inherit from class "B" from seeing the method <code>A.MethodToHide()</code>?  In C++, this was easy enough by using a declaration such as <code>class B : private A</code>, but this syntax is not valid in C#.</p>
  
  <p>For those interested (or wondering what I'm <em>really</em> trying to do), what we're trying to do is create a wrapper for for Rhino.Commons.NHRepository that hides the methods we don't want to expose to our group of developers, so we can have a cookie-cutter way of developing our app that new developers can easily follow.  So yes, I believe the "Is-A" test is valid for the whole chain (WidgetRepository Is-A BaseRepository Is-A NHRepository).</p>
  
  <p><strong>Edit</strong>:  I should have mentioned, for the sake of argument, that class A is an API class outside of our control.  Otherwise the problem gets considerably easier.</p>