Guest User

Untitled

a guest
Feb 3rd, 2014
525
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. 'System.Net.Http.HttpContent' does not contain a definition for
  2. 'ReadAsAsync' and no extension method 'ReadAsAsync' accepting a
  3. first argument of type 'System.Net.Http.HttpContent' could be
  4. found (are you missing a using directive or an assembly reference?)
  5.  
  6. static IEnumerable<Foo> GetAllFoos()
  7. {
  8. using (HttpClient client = new HttpClient())
  9. {
  10. client.DefaultRequestHeaders.Add("appkey", "myapp_key");
  11.  
  12. var response = client.GetAsync("http://localhost:57163/api/foo").Result;
  13.  
  14. if (response.IsSuccessStatusCode)
  15. return response.Content.ReadAsAsync<IEnumerable<Foo>>().Result.ToList();
  16. }
  17.  
  18. return null;
  19. }
  20.  
  21. <package id="Microsoft.AspNet.WebApi.Client" version="4.0.20710.0" />
Advertisement
Add Comment
Please, Sign In to add comment