title: How do you cast a dictionary<int, child> to dictionary<int, parent>?
body: <p>Let's say I have:</p>
  
  <pre><code>public class Animal
  {
      virtual public void Attack() {};
  }
  public class Lion : Animal
  {
      public override void Attack() { base.Attack(); }
  }
  public class Boar : Animal
  {
      public override void Attack() { base.Attack(); }
  }
  </code></pre>
  
  <p>And containers of these two types of animals:</p>
  
  <pre><code>Dictionary&lt;int, Lion&gt; lions;
  Dictionary&lt;int, Boar&gt; boars;
  </code></pre>
  
  <p>Is there a way to cast 'lions' and 'boars' so that I can pass them into a function like this?</p>
  
  <pre><code>void IterateTable(Dictionary&lt;int, Animal&gt; dictionary)
  {
      foreach(var entry in dictionary)
          entry.Value.Attack();
  }
  </code></pre>