Search code examples
c#.netasp.net-web-apihttpcontent

Where is HttpContent.ReadAsAsync?


I see in tons of examples on the web using the new HttpClient object (as part of the new Web API) that there should be HttpContent.ReadAsAsync<T> method. However, MSDN doesn't mention this method, nor does IntelliSense find it.

Where did it go, and how do I work around it?


Solution

  • It looks like it is an extension method (in System.Net.Http.Formatting):

    HttpContentExtensions Class

    Update:

    PM> install-package Microsoft.AspNet.WebApi.Client

    According to the System.Net.Http.Formatting NuGet package page, the System.Net.Http.Formatting package is now legacy and can instead be found in the Microsoft.AspNet.WebApi.Client package available on NuGet here.