Skip to content

Instantly share code, notes, and snippets.

@Regenhardt
Last active September 19, 2018 12:46
Show Gist options
  • Save Regenhardt/05f0227199bf435d3fe0c704062749cc to your computer and use it in GitHub Desktop.
Save Regenhardt/05f0227199bf435d3fe0c704062749cc to your computer and use it in GitHub Desktop.
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