title: Dynamic dispatch to derived class in C#
body: <p>I'm trying to do the following:</p>
  
  <pre><code>public abstract BaseClass {
  
    public virtual void ReceiveEvent(Event evt)
      {
          ProcessEvent(evt as dynamic);
      }
  
      private void ProcessEvent(object evt)
      { 
          LogManager.Log(@"Received an event that is not being processed! 
                          Dispatch fallback");
      }
  }
  
  public DerivedClass: BaseClass {
  
      private void ProcessEvent(SpecificEvent evt)
      { 
          LogManager.Log("Processing Event");
      }
  }
  </code></pre>
  
  <p>SpecificEvents hit the fallback method instead of the one in the derived class. I use dynamic dispatch within the same class all the time and find it really useful/clean. Will it not work with derived classes as illustrated in the example above?</p>
  
  <p><strong>EDIT:</strong>
  There seems to be some confusion in the answers. Basically i use the following design all the time:</p>
  
  <pre><code>public class SomeClass{
  
      public void DoSomethingDispatcher(SomeObject obj)
      {
          ProcessObject(obj as dynamic);
      }
  
      private void DoSomething(SomeObjectType1 obj)
      { 
  
      }
  
      private void DoSomething(SomeObjectType2 obj)
      { 
  
      }
  
      private void DoSomething(SomeObjectType3 obj)
      { 
  
      }
  
      private void DoSomething(object obj) //fallback
      { 
  
      }
  }
  </code></pre>
  
  <p>Works great for when <strong>you don't know the exact type beforehand and you don't want to use a big switch statement</strong>. Just wondering if this can be implemented with inheritance where the base class holds the fallback method and the derived class holds all the more specific methods.</p>