title: The proper way to end a BeginInvoke?
body: <p>I recently <a href="http://social.msdn.microsoft.com/Forums/en-US/clr/thread/b18b0a27-e2fd-445a-bcb3-22a315cd6f0d/" rel="nofollow noreferrer">read this thread on MSDN</a>.  So I was thinking of using a lambda expression as a way of calling EndInvoke just as a way to make sure everything is nice and tidy.  Which would be more correct?</p>
  
  <p>example 1:</p>
  
  <pre><code>Action&lt;int&gt; method = DoSomething;
  
  method.BeginInvoke(5, (a)=&gt;{method.EndInvoke(a);}, null);
  </code></pre>
  
  <p>Example 2:</p>
  
  <pre><code>Action&lt;int&gt; method = DoSomething;
  
  method.BeginInvoke(5, (a)=&gt;
                                    {
                                        Action&lt;int&gt; m = a.AsyncState as Action&lt;int&gt;;
                                        m.EndInvoke(a);
                                    }, method);
  </code></pre>