Why can anonymous methods be implicitly passed as Action?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/411579/why-must-a-lambda-expression-be-cast-when-supplied-as-a-plain-delegate-parameter">Why must a lambda expression be cast when supplied as a plain Delegate parameter</a>  </p>
</blockquote>



<p><code>Control.Invoke</code> accepts a <code>Delegate</code> parameter type.  I cannot pass a lamba expression as a <code>Delegate</code> without telling the compiler which type of delegate I'm passing.</p>

<p><code>textBox1.Invoke(() =&gt; { MessageBox.Show("Hello World"); });  //illegal</code></p>

<p>In this case, I can cast to <code>Action</code></p>

<p><code>textBox1.Invoke((Action)(() =&gt; { MessageBox.Show("Hello World"); }));  //legal</code></p>

<p>However, I can create a shorthand method via an extension method (I've seen Marc Gravell do this):</p>

<pre><code>public static void Invoke(this Control control, Action action)
{
    control.Invoke((Delegate)action);
}
</code></pre>

<p>Now my shorthand works...</p>

<p><code>textBox1.Invoke(() =&gt; { MessageBox.Show("Hello World"); });  //legal</code></p>

<p>How is it that the compiler can determine that an anonymous method is an Action in the extension method, but the compiler cannot determine a lamba is an Action and therefore a legal <code>Delegate</code> in the case of <code>Control.Invoke</code>?</p>
