我有一个 uwp,我需要从互联网上保存的 txt 文件中获取文本以进行字符串下载文件并将文本获取到字符串时遇到问题
这是我的代码:
var webRequest = WebRequest.Create(@"http://yourUrl");
using (var response = webRequest.GetResponse())
using (var content = response.GetResponseStream())
using (var reader = new StreamReader(content))
{
var strContent = reader.ReadToEnd();
}
谁能帮我?
var url = "http://example.com/abc.txt";
var textFromFile = (new WebClient()).DownloadString(url);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)