title: C# prevent base class method from being hidden by new modifier in the derived class
body: <p>Here's my situation. In Java I can mark a method as final in the base/super class and there is no way a derived class can mask a method of the same signature. In C# however, the new keyword allows someone inheriting my class to create a method with the same signature.</p>
  <p>See my example below. I need to keep the <code>orignal.MyClass</code> public so please don't suggest that as an answer. This seems to be a lost feature moving from Java to C#:</p>
  <pre class="lang-cs prettyprint-override"><code>public class orignal.MyClass{
      public void MyMethod()
      {
       // Do something
      }
  }
  
  class fake.MyClass: orignal.MyClass {
      // How to prevent the following
      public new void MyMethod()
      {
       // Do something different
      }
  }
  </code></pre>
  <p>EDIT: Not a duplicate.</p>
  <p>All answers seem to suggest, it's not possible to prevent a method from being hidden/shadowed in a derived class. This became apparent while migrating some old Java code to C#. A final method in Java will not let anybody use the same method signature in any derived class. While it's great in most scenarios that C# allows a method of same signature in the derived class, it would have been great to prevent such a behavior if warranted.</p>