title: Preventing a method from being overridden in C#
body: <p>How do I prevent a method from being overridden in a derived class?</p>
  
  <p>In Java I could do this by using the <code>final</code> modifier on the method I wish to prevent from being overridden.</p>
  
  <p>How do I achieve the same in C#?<br>
  I am aware of using <code>sealed</code> but apparently I can use it only with the <code>override</code> keyword?</p>
  
  <pre><code>class A
  {
      public void methodA()
      {
          // Code.
      }
  
      public virtual void methodB()
      {
          // Code.
      }
  }
  
  class B : A
  {
      sealed override public void methodB()
      {
          // Code.
      } 
  }
  </code></pre>
  
  <p>So in the above example I can prevent the <code>methodB()</code> from being overridden by any classes deriving from class <code>B</code>, but how do I prevent class <code>B</code> from overriding the <code>methodB()</code> in the first place?</p>
  
  <p>Update: I missed the <code>virtual</code> keyword in the <code>methodB()</code> declaration on class A when i posted this question. Corrected it.</p>