title: How to build double dispatch using extensions
body: <p>I have a library that have a hierarchy of class as follow:</p>
  
  <pre><code>class Base {}
  class A : Base {}
  class B : Base {}
  </code></pre>
  
  <p>Now I wanted to do different thing depending on type of my object whether it is an A or a B.
  So I decide to go for and implement double dispatching to avoid checking type.</p>
  
  <pre><code>class ClientOfLibrary {
  
      public DoStuff(Base anObject)
      {
         anObject.MakeMeDoStuff(this);
      }
  
      private void DoStuffForanA(A anA);
      private void DoStuffForaB(B aB);
  }
  </code></pre>
  
  <p>Now the canonical way of implementing double dispatch is to make the method <code>MakeMeDoStuff</code> abstract in <code>Base</code> and overload it in concrete class. But remember that <code>Base</code>, <code>A</code> and <code>B</code> are in library so I can not go and add does method freely.</p>
  
  <p>Adding method extension wont work because there is no way to add an abstract extensions.</p>
  
  <p>Any suggestion?</p>