title: What's the method signature for passing an async delegate?
body: <p>I've recently moved back to C# from being in Objective-C land, and the async/await keywords in C# 5 look cool. But I'm still trying to get a handle on the proper syntax.</p>
  
  <p>I want to declare a method that takes an asynchronous delegate as a parameter, but I am having trouble getting both the caller and the callee syntax correct. Can someone provide a code sample showing the method declaration, the call, and a call to the delegate?</p>
  
  <p>I'm thinking the declaration would be something like the following. Note that this function isn't asynchronous; i.e. its asynchronicity is independent of the delegate.</p>
  
  <pre><code>void DoSomethingWithCallback(async delegate foo(int)) 
  {
      ...
      foo(42);
      ...
  }
  </code></pre>
  
  <p>The call would be something like:</p>
  
  <pre><code>DoSomethingWithCallback(async (int x) =&gt; { this.SomeProperty = await SomeAsync(x); });
  </code></pre>
  
  <p>Of course none of this compiles and most of the samples I've seen assume that one has a field or property that's the delegate, rather than the anonymous delegate I'd like to use.</p>