using Async() with no await? RRS feed

  • Question

  • Hello, I've come across the following little code block in the JSON.NET documentation describing a method of deserializing some json:

    using (Stream s = httpClient.GetStreamAsync(someUriString).Result)
    using (StreamReader sr = new StreamReader(s))
    using (JsonReader reader = new JsonTextReader(sr))
        JsonSerializer serializer = new JsonSerializer();
        var result = serializer.Deserialize<MyType>(reader);

    I can't understand how this works. The second "using" statement makes use of the result from the first "using" statement where they are using the async version of the method...but there is no use of the "await" keyword to ensure completion of the first "using" statement task before executing the second "using" statement. Can somebody please explain to me how this works? Thank you in advance.


    Tuesday, April 4, 2017 4:33 PM