title: c# overrides method with dictionary that has base type
body: <p>NOTE: this question is subtly different than the potential duplicate ... and this has answers that work - read both before voting please :) . </p>
  
  <p>--</p>
  
  <p>We have two dictionaries that have a common base type for the value:</p>
  
  <p>Here is the Code:</p>
  
  <pre><code>// Three classes
  class BaseClass {...}
  class Foo : BaseClass {...}
  class Bar : BaseClass {...}
  
  // Two collections
  var fooDict = new Dictionary&lt;long, Foo&gt;;
  var barDict = new Dictionary&lt;long, Bar&gt;;
  
  // One method
  public void FooBar (Dictionary&lt;long, BaseClass&gt; dict) {...}
  
  // These do not work
  FooBar(fooDict);
  FooBar(barDict);
  </code></pre>
  
  <p>Is there a way for inheritance to work in a dictionary, or do we have to use a different paradigm - or am I just being stupid?</p>
  
  <p>Any help or guidance with this would be appreciated.</p>
  
  <p>Thank you in advance.</p>