Skip to content

Instantly share code, notes, and snippets.

@escamoteur
Created January 4, 2017 13:23
Show Gist options
  • Save escamoteur/45acdb22edf33d4c93a6439cc25b72ae to your computer and use it in GitHub Desktop.
Save escamoteur/45acdb22edf33d4c93a6439cc25b72ae to your computer and use it in GitHub Desktop.
using (var httpClient = new HttpClient())
{
using (var request = new HttpRequestMessage(HttpMethod.Get,
"http://www.burkharts.net/QuoteMyDaySampleData.json"))
{
using (var response = await httpClient.SendAsync(request))
{
Stream contentStream = await (response.Content.ReadAsStreamAsync());
var json = new JsonSerializer();
using (var reader = new StreamReader(contentStream))
{
list = (List<MyDay>) json.Deserialize(reader, typeof(List<MyDay>));
}
contentStream.Dispose();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment