我正在使用.net框架3.5开发手机应用程序,该应用程序使用API服务调用来检查来自website.I的电子邮件地址。现在用下面的代码来执行,命名空间'System.Net'中不存在类型或名称空间名称'Http'
using System.Net.Http;
HttpClient webClient = new HttpClient();
webClient.QueryString.Add("email", email);
Stream stream = webClient.OpenRead(brandEndPoint);
最初我用WebClient
代替HttpClient
和我得到这个错误“The type or namespace name 'WebClient' could not be found
”谷歌和与HttpClient
固定这一点。
将WebClient
替换为HttpClient
后,我收到此错误“The type or namespace name 'Http' does not exist in the namespace 'System.Net
”。
需要帮助来解决这个问题。
由于
@Steve:为什么? HttpClient在System.Net.Http命名空间中:http://msdn.microsoft.com/en-gb/library/system.net.http.httpclient.aspx –
不适用于.NET 3.5。命名空间根本不可用3.5 –
@JonSkeet确实太快了,用LinqPAD中的Intellisense看,错过了参考并跳到了错误的结论 – Steve