C#:一个网页的阅读HTML源到一个字符串 [英] c#: reading html source of a webpage into a string
本文介绍了C#:一个网页的阅读HTML源到一个字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想能够使用的WinForms读取某个网页的HTML源到C#中的字符串
我如何做到这一点?
解决方案
字符串HTML =新的WebClient()。DownloadString(http://twitter.com) ;在C#5
$ B $
和现在异步/等待辣味:b
字符串HTML =等待新的WebClient()DownloadStringTaskAsync(http://github.com);
i would like to be able to read the html source of a certain webpage into a string in c# using winforms
how do i do this?
解决方案
string html = new WebClient().DownloadString("http://twitter.com");
And now with async/await hotness in C# 5
string html = await new WebClient().DownloadStringTaskAsync("http://github.com");
这篇关于C#:一个网页的阅读HTML源到一个字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文