title: Calling the overridden method from the base class in C#
body: <p>Given the following C# class definitions and code:</p>
  <pre><code>
  public class BaseClass
  {
      public virtual void MyMethod()
      {
          ...do something...
      }
  }
  
  public class A : BaseClass
  {
      public override void MyMethod()
      {
          ...do something different...
      }
  }
  
  public class B : BaseClass
  {
      public override void MyMethod()
      {
          ...do something different...
      }
  }
  
  public class AnotherObject
  {
      public AnotherObject(BaseClass someObject)
      {
          someObject.MyMethod(); //This calls the BaseClass method, unfortunately.
      }
  }
  </code></pre>
  <p>I would like to call the <code>MyMethod()</code> that is actually found in A or B, assuming the object passed in is actually an instance of A or B, not that which is found in <code>BaseClass</code>.  Short of doing something like this:</p>
  <pre><code>
  public class AnotherObject
  {
      public AnotherObject(BaseClass someObject)
      {
          A temp1 = someObject as A;
          if (A != null)
          {
              A.MyMethod();
          }
          
          B temp2 = someObject as B;
          if (B != null)
          {
              B.MyMethod();
          }
      }
  }
  </code></pre>
  <p>How can I do it?</p>