title: Why are lambda expression arguments ambiguous between Func and Expression<Func>?
body: <p>Suppose I have a class:</p>
  
  <pre><code>class MyClass {
      public int MyMethod(Func&lt;int, int&gt; f) { return 0; }
      public int MyMethod(Expression&lt;Func&lt;int, int&gt;&gt; f) { return 1; }
  }
  </code></pre>
  
  <p>When I try to call the method with a lambda expression, I get a compile error stating that the call is ambiguous between the two overloads:</p>
  
  <pre><code>var myClass = new MyClass();
  myClass.MyMethod(x =&gt; 1 + x); // Error!
  </code></pre>
  
  <p>while, of course, calling with an explicit type works fine:</p>
  
  <pre><code>myClass.MyMethod((Func&lt;int, int&gt;)(x =&gt; 1 + x)); // OK, returns 0
  myClass.MyMethod((Expression&lt;Func&lt;int, int&gt;&gt;)(x =&gt; 1 + x)); // OK, returns 1
  </code></pre>
  
  <p>The expression tree contains more information (the actual code), and I may want to make use of this information when it is available. But I also want my code to work with delegates. Unfortunately, this ambiguity makes it so I have to find another way to distinguish between the two calls, which messes up an otherwise clean API.</p>
  
  <p>The C# spec doesn't say anything about this specific situation, so in this sense the behavior does match the spec.</p>
  
  <p>However, there is an argument to be made that the expression tree should be preferred over the delegate. The <code>Compile</code> method acts as an explicit conversion from an expression tree to a delegate. The expression tree contains more information, and when you compile to a delegate, you lose that information. There is no conversion in the other direction.</p>
  
  <p>Are there any reasons not to prefer the expression tree?</p>