HttpContent.ReadAsAsync 在哪里? [英] Where is HttpContent.ReadAsAsync?

查看:16
本文介绍了HttpContent.ReadAsAsync 在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在网络上看到大量使用新 HttpClient 对象(作为新 Web API 的一部分)的示例,应该有 HttpContent.ReadAsAsync方法.但是,MSDN 没有提到这个方法,IntelliSense也没找到.

它去了哪里,我该如何解决?

解决方案

看起来是一个扩展方法(在System.Net.Http.Formatting中):

HttpContentExtensions 类

更新:

<块引用>

PM> 安装包 Microsoft.AspNet.WebApi.Client

根据 System.Net.Http.Formatting NuGet 包页面,System.Net.Http.Formatting 包现在是旧包,可以在 NuGet 在这里.

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?

解决方案

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.

这篇关于HttpContent.ReadAsAsync 在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆