当前位置:首页 > 开发 > C# > 正文内容

C# 获取网页源代码

C#4年前 (2022-10-26)
private static string GetHtml(string url)
{
WebClient myWebClient = new WebClient();
byte[] myDataBuffer = myWebClient.DownloadData(url);
myWebClient.Dispose();
return Encoding.UTF8.GetString(myDataBuffer);
}


转载请注明出处。

本文链接:http://pythonopen.com/?id=230

相关文章

C# 获取Windows系统目录

Environment.GetFolderPath(Environment.SpecialFolde...

C# 缩减代码量的一些方式

static void Main() { Thread thre...

C# [OnPaint]和[OnPaintBackground]的区别

OnPaint和OnPaintBackground的主要功能区别OnPaint:OnPaint方法主...

C# Byte[]转为Bitmap

在 C# 中,可以使用System.Drawing命名空间下的相关类将byte[]类型的数据转换为B...

C# using与多重using

1. using 语句概述在 C# 中,using 语句主要用于确保实现了 IDisposable...

C# 控件判断鼠标位置

        //...