title: C# - automatic delegate type from method
body: <p>Any way to avoid explicitly declaring <code>MyMethodDelegate</code> in a scenario like this?</p>
  
  <pre><code>bool MyMethod(string x)
  {
      //...
  }
  
  BeginInvoke(new MyMethodDelegate(MyMethod), x);
  </code></pre>
  
  <p>I know about lambdas a-la <code>()=&gt;MyMethod(x)</code>, however I want to avoid them sometimes as they break edit-and-continue.</p>
  
  <p><strong>Edit</strong>: just <code>BeginInvoke(MyMethod, x)</code> does not work:</p>
  
  <pre><code>The best overloaded method match for 'System.Windows.Forms.Control.BeginInvoke(System.Delegate, params object[])' has some invalid arguments
  Argument 1: cannot convert from 'method group' to 'System.Delegate'
  Argument 2: cannot convert from 'string' to 'object[]'
  </code></pre>
  
  <p>BeginInvoke is defined as follows:</p>
  
  <pre><code>public IAsyncResult BeginInvoke(Delegate method, params object[] args);
  </code></pre>
  
  <p>It does not specify any specific delegate type, so the compiler cannot detect which delegate type to instantiate from <code>BeginInvoke(MyMethod. x)</code> </p>