title: Create generic async task function
body: <p>I have created a function that returns an object using <code>async</code>/<code>await</code>. I would like to make the function generic so that it can return whatever object that I pass in. The code is boilerplate except for the objects being returned. I would like to be able to call GetAsync and have it return the correct object</p>
  
  <pre><code>public Patron getPatronById(string barcode)
  {
      string uri = "patrons/find?barcode=" + barcode;
      Patron Patron =  GetAsync(uri).Result;
      return Patron;
  }
  
  private async Task&lt;Patron&gt; GetAsync(string uri)
  {
      var client = GetHttpClient(uri);
      var content = await client.GetStringAsync(uri);
      JavaScriptSerializer ser = new JavaScriptSerializer();
      Patron Patron = ser.Deserialize&lt;Patron&gt;(content);
      return Patron;
  }
  </code></pre>