最快的C#代码下载一个网页 [英] Fastest C# Code to Download a Web Page

查看:127
本文介绍了最快的C#代码下载一个网页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

给出一个网址,这将是最高效的代码来下载该网页的内容?我只考虑HTML,没有相关的图片,JS和CSS。


解决方案

 公开静态无效DownloadFile(字符串remoteFilename,串localFilename)
{
WebClient的客户端=新的WebClient();
client.DownloadFile(remoteFilename,localFilename);
}


Given a URL, what would be the most efficient code to download the contents of that web page? I am only considering the HTML, not associated images, JS and CSS.

解决方案

public static void DownloadFile(string remoteFilename, string localFilename)
{
    WebClient client = new WebClient();
    client.DownloadFile(remoteFilename, localFilename);
}

这篇关于最快的C#代码下载一个网页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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