更新时间:2023-01-26 07:51:47
使用 Web客户端
类 System.Net
:
var json = new WebClient().DownloadString("url");
记
请即 Web客户端
是的IDisposable
,所以你可能会添加使用
语句来此生产code。这将是这样的:
Keep in mind that WebClient
is IDisposable
, so you would probably add a using
statement to this in production code. This would look like:
using (WebClient wc = new WebClient())
{
var json = wc.DownloadString("url");
}