title: Action to Delegate : new Action or casting Action?
body: <p>I found two different ways to initialize a Delegate with an Action :</p>
  
  <p>Create a new action or casting to Action.</p>
  
  <pre><code>Delegate foo = new Action(() =&gt; DoNothing(param));
  Delegate bar = (Action)(() =&gt; DoNothing(param));
  </code></pre>
  
  <p>Is there a difference between this 2 syntaxes? </p>
  
  <p>Which one is better and why?</p>
  
  <p>Delegate is use in this example because the syntaxes is useful to call methods like BeginInvoke or Invoke with a lambda expression, and it's important to cast the lambda expression into an action</p>
  
  <pre><code>static main 
  {
      Invoke((Action)(() =&gt; DoNothing())); // OK
      Invoke(new Action(() =&gt; DoNothing())); // OK
      Invoke(() =&gt; DoNothing()); // Doesn't compil
  }
  
  private static void Invoke(Delegate del) { }
  </code></pre>
  
  <p>But it's interesting to see that the compiler authorized this :</p>
  
  <pre><code>Action action = () =&gt; DoNothing();
  Invoke(action);
  </code></pre>