Skip to content

Instantly share code, notes, and snippets.

@shammelburg
Created January 25, 2017 12:06
Show Gist options
  • Save shammelburg/aedaada2677014670599c18e60212324 to your computer and use it in GitHub Desktop.
Save shammelburg/aedaada2677014670599c18e60212324 to your computer and use it in GitHub Desktop.
Using HttpClient and Deserialize
using (var client = new HttpClient())
{
var data = client.GetAsync(new Uri($"{AppSettingsHelper.api_url}/Controller/Action?Parameter={variable}")).Result;
string json = data.Content.ReadAsStringAsync().Result;
list = JsonConvert.DeserializeObject<List<ViewModel>>(json);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment