title: Anonymous method in Invoke call
body: <p>Having a bit of trouble with the syntax where we want to call a delegate anonymously within a Control.Invoke.</p>
  
  <p>We have tried a number of different approaches, all to no avail.</p>
  
  <p>For example:</p>
  
  <pre><code>myControl.Invoke(delegate() { MyMethod(this, new MyEventArgs(someParameter)); }); 
  </code></pre>
  
  <p>where someParameter is local to this method</p>
  
  <p>The above will result in a compiler error:</p>
  
  <blockquote>
    <p>Cannot convert anonymous method to type 'System.Delegate' because it is not a delegate type</p>
  </blockquote>