title: C# 3.0 generic type inference - passing a delegate as a function parameter
body: <p>I am wondering why the C# 3.0 compiler is unable to infer the type of a method when it is passed as a parameter to a generic function when it can implicitly create a delegate for the same method.</p>
  
  <p>Here is an example:</p>
  
  <pre><code>class Test
  {
      static void foo(int x) { }
      static void bar&lt;T&gt;(Action&lt;T&gt; f) { }
  
      static void test()
      {
          Action&lt;int&gt; f = foo; // I can do this
          bar(f); // and then do this
          bar(foo); // but this does not work
      }   
  }
  </code></pre>
  
  <p>I would have thought that I would be able to pass <code>foo</code> to <code>bar</code> and have the compiler infer the type of <code>Action&lt;T&gt;</code> from the signature of the function being passed but this does not work.  However I can create an <code>Action&lt;int&gt;</code> from <code>foo</code> without casting so is there a legitimate reason that the compiler could not also do the same thing via type inference?</p>