title: Extension method for IDictionary<t, k> : The type arguments for method cannot be inferred from the usage
body: <p>In an attempt to clean up a lot of repeated code, I tried implementing the extension method below:</p>
  
  <pre><code>    public static void AddIfNotPresent(this IDictionary&lt;TKey, TValue&gt; dictionary, TKey key, TValue value)
      {
          if (!dictionary.ContainsKey(key))
          {
              dictionary.Add(key, value);
          }
      }
  
      public static void Test()
      {
          IDictionary&lt;string, string&gt; test = new Dictionary&lt;string, string&gt;();
          test.AddIfNotPresent("hi", "mom");
      }
  </code></pre>
  
  <p>Results in a compiler error during the extension method call of:</p>
  
  <p>The type arguments for method 'Util.Test.AddIfNotPresent(this System.Collections.Generic.IDictionary dictionary, TKey key, TValue value)' cannot be inferred from the usage.  Try specifying the type arguments explicitly.</p>
  
  <p>Any light on this subject would be much appreciated!</p>