我可能缺少一些基本的东西,但是这种方法是怎么来的:
namespace System.Net
{
public static class WebClientExtensions
{
public static Task<byte[]> DownloadDataTask(this WebClient webClient, string address)
{
return DownloadDataTask(webClient, new Uri(address));
}
}
}
是这样调用的:
return new WebClient().DownloadDataTask(url)
这取自 ParallelExtensionsExtras Tour - #16 - Async Tasks for WebClient。