Where is HttpContent.ReadAsAsync?

后端 未结 6 1139

I see in tons of examples on the web using the new HttpClient object (as part of the new Web API) that there should be HttpContent.ReadAsAsync

6条回答
  •  囚心锁ツ
    2020-11-29 18:12

    You can write extention method:

    public static async Task ReadAsAsync(this System.Net.Http.HttpContent content) {
        return Newtonsoft.Json.JsonConvert.DeserializeObject(await content.ReadAsStringAsync());
    }
    

提交回复
热议问题