title: How do I set up the continuations for HttpClient correctly?
body: <p>I'm using .NET 4.0, so I can't use the async/await keywords.</p>
  
  <p>After I laboriously set up tasks and continuations instead of just calling .Result, all I got for my efforts was a mess and it runs 46% slower on a workload of a few dozen HTTP GETs. (I get similar perf degradation if I call the workload in serial or in a Parallel loop)</p>
  
  <p>What must I do to see any performance benefit?</p>
  
  <pre><code>//Slower code
  public UserProfileViewModel GetAsync(Guid id)
  {
      UserProfileViewModel obj = null;//Closure
      Task result = client.GetAsync(id.ToString()).ContinueWith(responseMessage =&gt;
      {
              Task&lt;string&gt; stringTask = responseMessage.Result
                                              .Content.ReadAsStringAsync();
              Task continuation = stringTask.ContinueWith(responseBody =&gt;
              {
                  obj = JsonConvert
                       .DeserializeObject&lt;UserProfileViewModel&gt;(responseBody.Result);
              });
              //This is a child task, must wait before returning to parent.
              continuation.Wait();
          });
      result.Wait();
      return obj;
  }
  
  //Faster code
  public UserProfileViewModel GetSynchr(Guid id)
  {
      //Asych? What's is that?
      HttpResponseMessage response = client.GetAsync(id.ToString()).Result;
      string responseBody = response.Content.ReadAsStringAsync().Result;
      return JsonConvert.DeserializeObject&lt;UserProfileViewModel&gt;(responseBody);
  }
  </code></pre>