title: Problem getting generic extension method to work correctly
body: <p>I'm trying to create the extension method AddRange for HashSet so I can do something like this:</p>
  
  <pre><code>var list = new List&lt;Item&gt;{ new Item(), new Item(), new Item() };
  var hashset = new HashSet&lt;Item&gt;();
  hashset.AddRange(list);
  </code></pre>
  
  <p>This is what I have so far:</p>
  
  <pre><code>public static void AddRange&lt;T&gt;(this ICollection&lt;T&gt; collection, List&lt;T&gt; list)
  {
      foreach (var item in list)
      {
          collection.Add(item);
      }
  }
  </code></pre>
  
  <p>Problem is, when I try to use AddRange, I'm getting this compiler error:</p>
  
  <p><code>The type arguments for method 'AddRange&lt;T&gt;(System.Collections.Generic.ICollection&lt;T&gt;, System.Collections.Generic.List&lt;T&gt;)' cannot be inferred from the usage. Try specifying the type arguments explicitly.</code></p>
  
  <p>In other words, I have to end up using this instead:</p>
  
  <pre><code>hashset.AddRange&lt;Item&gt;(list);
  </code></pre>
  
  <p>What am I doing wrong here?</p>