title: Wrap a function as an async task
body: <p>I have a function that I would like to wrap so that I can use the async/await pattern:</p>
  
  <pre><code>wcfClientService.GetSomeString(parameter);
  </code></pre>
  
  <p>It's a call from a WCF client that I'm trying to make asynchronous, but that's not important (I know WCF supports async, but let's assume we don't have access to the WCF code).</p>
  
  <p>I'm trying to wrap the method with the <code>Task&lt;T&gt;.Factory.FromAsync</code> method, but can't seem to get it right:</p>
  
  <pre><code>private Task&lt;string&gt; WrapWcfServiceAsyncTask(uint parameter)
  {
      Func&lt;uint, string&gt; func = i =&gt; { return wcfClientService.GetSomeString(parameter); };
  
      var t = Task&lt;string&gt;.Factory.FromAsync(
                                             // What goes here?
                                            );
      return t;
  }
  </code></pre>
  
  <p>Or even better, can someone write a method that takes a method as a parameter, and wraps and returns a <code>Task&lt;T&gt;</code> for it?</p>