title: C# Adding Generic List to a Dictionary
body: <p>So I'm running into a problem with generic lists in C# such that:</p>
  
  <pre><code>var foo = new Dictionary&lt;long, List&lt;object&gt;&gt;();
  foo.Add(123, new List&lt;string&gt;());
  </code></pre>
  
  <p>Gives the error: <code>Cannot convert from System.Collections.Generic.List&lt;string&gt; to System.Collections.Generic.List&lt;object&gt;</code></p>
  
  <p>Where as this works fine:</p>
  
  <pre><code>var foo = new Dictionary&lt;long, object&gt;();
  foo.Add(123, new string());
  </code></pre>
  
  <p>My real use case would look like this:</p>
  
  <pre><code>var foo = new Dictionary&lt;long, List&lt;ISomeInterface&gt;&gt;();
  foo.Add(123, new List&lt;SomeClassA&gt;());
  foo.Add(345, new List&lt;SomeClassB&gt;());
  </code></pre>
  
  <p>Where both SomeClassA and SomeClassB implement ISomeInterface.  Is this possible?</p>
  
  <p>The idea being I can grab a list of ISomeInterface from the dictionary and iterate the list calling SomeMethod that is defined on ISomeInterface.</p>