vs2010 中 怎么引用 WEBclient
时间: 2024-06-08 21:05:51 浏览: 95
在 VS2010 中引用 WebClient,需要执行以下步骤:
1. 打开 Visual Studio 2010,创建一个新的 C# 控制台应用程序项目。
2. 在“解决方案资源管理器”窗口中,右键单击“引用”文件夹,并选择“添加引用”。
3. 在“添加引用”对话框中,选择“系统”选项卡。
4. 在列表中找到“System.Net”组件,选中它,并单击“确定”按钮。
5. 在你的代码中添加“using System.Net;”语句,以便使用 WebClient 类。
现在你就可以使用 WebClient 类来发送 HTTP 请求和接收 HTTP 响应了。例如:
```csharp
using System;
using System.Net;
class Program
{
static void Main(string[] args)
{
WebClient client = new WebClient();
string result = client.DownloadString("http://www.example.com");
Console.WriteLine(result);
}
}
```
阅读全文
相关推荐








