title: Generics: Why can't the compiler infer the type arguments in this case?
body: <p>I wanted to write an extension-method that would work on dictionaries whose values were some sort of sequence. Unfortunately, the compiler can't seem to infer the generic arguments from my usage of the method; I need to specify them explicitly.</p>
  
  <pre><code>public static void SomeMethod&lt;TKey, TUnderlyingValue, TValue&gt;
      (this IDictionary&lt;TKey, TValue&gt; dict)
      where TValue : IEnumerable&lt;TUnderlyingValue&gt; { }    
  
  static void Usage()
  {
      var dict = new Dictionary&lt;int, string[]&gt;();
      var dict2 = new Dictionary&lt;int, IEnumerable&lt;string&gt;&gt;();
  
      //These don't compile
      dict.SomeMethod();
      SomeMethod(dict); // doesn't have anything to do with extension-methods
      dict2.SomeMethod(); // hoped this would be easier to infer but no joy
  
  
      //These work fine
      dict.SomeMethod&lt;int, string, string[]&gt;();
      dict2.SomeMethod&lt;int, string, IEnumerable&lt;string&gt;&gt;();
  }
  </code></pre>
  
  <p>I realize that type inference isn't an exact science, but I was wondering if there's some fundamental 'rule' I'm missing here - I'm not familiar with the details of the spec.</p>
  
  <ol>
  <li>Is this a shortcoming of the inference process or is my expectation that the compiler should "figure it out" unreasonable in this case (ambiguity perhaps)? </li>
  <li>Can I change the  method's signature in a way that would make it equally functional yet 'inferrable'?</li>
  </ol>