I wish to use streams as recommended by the json.net performance tips documentation, however I\'m unable to find how to get a hold of the http status codes without the typical a
I haven't tested to ensure it's performance, however this seems promising:
using(HttpClient client = new HttpClient())
{
var response = await client.GetAsync("http://httpbin.org/get", HttpCompletionOption.ResponseHeadersRead);
response.EnsureSuccessStatusCode();
using (var stream = await response.Content.ReadAsStreamAsync())
using (var streamReader = new StreamReader(stream))
using (var jsonReader = new JsonTextReader(streamReader))
{
var serializer = new JsonSerializer();
//do some deserializing http://www.newtonsoft.com/json/help/html/Performance.htm
}
}