我有一段代码用 windows.web.http 读取 HttpResponseContent

using System.IO;
        using Windows.Web.Http;
        using Newtonsoft.Json;

        var responseContent = JsonConvert.DeserializeObject<HttpResponseContent>(response.Content.ToString());
        if (response.StatusCode == HttpStatusCode.Ok) 
        {
            //convert only from this line
            using (var input =
                await response.Content.ReadAsInputStreamAsync()
                                      .AsTask()
                                      .ConfigureAwait(false))
            using (var stream = input.AsStreamForRead())
            using (StreamReader sr = new StreamReader(stream))
            using (JsonReader reader = new JsonTextReader(sr)) //to this line
        {
                return DeserializeTerminals(reader);
        }

Question 1 :如何使用 system.net.http 命名空间实现此目的?

注意:我使用 windows.web.httpuwp 中编写了这些代码,我想要的是使用不同的包/命名空间转换该代码,这是我在Azure Functions中使用的 system.net.http .

Reference Link: https://docs.microsoft.com/en-us/dotnet/api/system.net.http?view=netframework-4.7.2 https://docs.microsoft.com/en-us/uwp/api/windows.web.http

谢谢