Last active
September 19, 2018 12:46
-
-
Save Regenhardt/05f0227199bf435d3fe0c704062749cc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyWebClient | |
{ | |
public async Task<string> DownloadString(string uri) | |
{ | |
using (HttpClient client = new HttpClient()) | |
{ | |
using (HttpResponseMessage response = client.GetAsync(uri).Result) | |
{ | |
using (HttpContent content = response.Content) | |
{ | |
return await content.ReadAsStringAsync(); | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment