コード例 #1
0
        public static async Task <string> HttpDownloadStringAsync(
            string uri,
            Configure <WebClient> clientConfigurator        = null,
            Action <WebHeaderCollection> headerConfigurator = null,
            Action <WebRequest> requestConfigurator         = null)
        {
            WebClient webClient = new CustomWebClient(requestConfigurator);

            webClient = clientConfigurator.InvokeSafe(webClient);
            headerConfigurator?.Invoke(webClient.Headers);

            return(await webClient.DownloadStringTaskAsync(new Uri(uri)));
        }