HttpClientJsonExtensions.GetFromJsonAsync 方法

定義

多載

GetFromJsonAsync(HttpClient, Uri, Type, JsonSerializerOptions, CancellationToken)

將 GET 要求傳送至指定的 URI,並傳回在非同步作業中,將回應主體作為 JSON 還原序列化後所產生的值。

GetFromJsonAsync(HttpClient, String, Type, JsonSerializerContext, CancellationToken)

將 GET 要求傳送至指定的 URI,並傳回在非同步作業中,將回應主體作為 JSON 還原序列化後所產生的值。

GetFromJsonAsync(HttpClient, Uri, Type, JsonSerializerContext, CancellationToken)

將 GET 要求傳送至指定的 URI,並傳回在非同步作業中,將回應主體作為 JSON 還原序列化後所產生的值。

GetFromJsonAsync(HttpClient, Uri, Type, CancellationToken)

將 GET 要求傳送至指定的 URI,並傳回在非同步作業中,將回應主體作為 JSON 還原序列化後所產生的值。

GetFromJsonAsync(HttpClient, String, Type, CancellationToken)

將 GET 要求傳送至指定的 URI,並傳回在非同步作業中,將回應主體作為 JSON 還原序列化後所產生的值。

GetFromJsonAsync(HttpClient, String, Type, JsonSerializerOptions, CancellationToken)

將 GET 要求傳送至指定的 URI,並傳回在非同步作業中,將回應主體作為 JSON 還原序列化後所產生的值。

GetFromJsonAsync<TValue>(HttpClient, String, CancellationToken)

將 GET 要求傳送至指定的 URI,並傳回在非同步作業中,將回應主體作為 JSON 還原序列化後所產生的值。

GetFromJsonAsync<TValue>(HttpClient, Uri, CancellationToken)

將 GET 要求傳送至指定的 URI,並傳回在非同步作業中,將回應主體作為 JSON 還原序列化後所產生的值。

GetFromJsonAsync<TValue>(HttpClient, String, JsonSerializerOptions, CancellationToken)

將 GET 要求傳送至指定的 URI,並傳回在非同步作業中,將回應主體作為 JSON 還原序列化後所產生的值。

GetFromJsonAsync<TValue>(HttpClient, String, JsonTypeInfo<TValue>, CancellationToken)

將 GET 要求傳送至指定的 URI,並傳回在非同步作業中,將回應主體作為 JSON 還原序列化後所產生的值。

GetFromJsonAsync<TValue>(HttpClient, Uri, JsonSerializerOptions, CancellationToken)

將 GET 要求傳送至指定的 URI,並傳回在非同步作業中,將回應主體作為 JSON 還原序列化後所產生的值。

GetFromJsonAsync<TValue>(HttpClient, Uri, JsonTypeInfo<TValue>, CancellationToken)

將 GET 要求傳送至指定的 URI,並傳回在非同步作業中,將回應主體作為 JSON 還原序列化後所產生的值。

GetFromJsonAsync(HttpClient, Uri, Type, JsonSerializerOptions, CancellationToken)

Source:
HttpClientJsonExtensions.Get.cs
Source:
HttpClientJsonExtensions.Get.cs
Source:
HttpClientJsonExtensions.Get.cs

將 GET 要求傳送至指定的 URI,並傳回在非同步作業中,將回應主體作為 JSON 還原序列化後所產生的值。

public static System.Threading.Tasks.Task<object?> GetFromJsonAsync (this System.Net.Http.HttpClient client, Uri? requestUri, Type type, System.Text.Json.JsonSerializerOptions? options, System.Threading.CancellationToken cancellationToken = default);
static member GetFromJsonAsync : System.Net.Http.HttpClient * Uri * Type * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<obj>
<Extension()>
Public Function GetFromJsonAsync (client As HttpClient, requestUri As Uri, type As Type, options As JsonSerializerOptions, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Object)

參數

client
HttpClient

用來傳送要求的用戶端。

requestUri
Uri

傳送要求的目標 URI。

type
Type

要還原序列化並傳回之物件的類型。

options
JsonSerializerOptions

在還原序列化期間控制行為的選項。 預設選項是 Web 所指定的選項。

cancellationToken
CancellationToken

取消語彙基元,可由其他物件或執行緒用來接收取消通知。

傳回

工作物件,表示非同步作業。

例外狀況

取消權杖已取消。 此例外狀況會儲存在傳回的工作中。

適用於

GetFromJsonAsync(HttpClient, String, Type, JsonSerializerContext, CancellationToken)

Source:
HttpClientJsonExtensions.Get.cs
Source:
HttpClientJsonExtensions.Get.cs
Source:
HttpClientJsonExtensions.Get.cs

將 GET 要求傳送至指定的 URI,並傳回在非同步作業中,將回應主體作為 JSON 還原序列化後所產生的值。

public static System.Threading.Tasks.Task<object?> GetFromJsonAsync (this System.Net.Http.HttpClient client, string? requestUri, Type type, System.Text.Json.Serialization.JsonSerializerContext context, System.Threading.CancellationToken cancellationToken = default);
static member GetFromJsonAsync : System.Net.Http.HttpClient * string * Type * System.Text.Json.Serialization.JsonSerializerContext * System.Threading.CancellationToken -> System.Threading.Tasks.Task<obj>
<Extension()>
Public Function GetFromJsonAsync (client As HttpClient, requestUri As String, type As Type, context As JsonSerializerContext, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Object)

參數

client
HttpClient

用來傳送要求的用戶端。

requestUri
String

傳送要求的目標 URI。

type
Type

要還原序列化並傳回之物件的類型。

context
JsonSerializerContext

用來控制還原序列化行為的 JsonSerializerCoNtext。

cancellationToken
CancellationToken

取消語彙基元,可由其他物件或執行緒用來接收取消通知。

傳回

工作物件,表示非同步作業。

例外狀況

取消權杖已取消。 此例外狀況會儲存在傳回的工作中。

適用於

GetFromJsonAsync(HttpClient, Uri, Type, JsonSerializerContext, CancellationToken)

Source:
HttpClientJsonExtensions.Get.cs
Source:
HttpClientJsonExtensions.Get.cs
Source:
HttpClientJsonExtensions.Get.cs

將 GET 要求傳送至指定的 URI,並傳回在非同步作業中,將回應主體作為 JSON 還原序列化後所產生的值。

public static System.Threading.Tasks.Task<object?> GetFromJsonAsync (this System.Net.Http.HttpClient client, Uri? requestUri, Type type, System.Text.Json.Serialization.JsonSerializerContext context, System.Threading.CancellationToken cancellationToken = default);
static member GetFromJsonAsync : System.Net.Http.HttpClient * Uri * Type * System.Text.Json.Serialization.JsonSerializerContext * System.Threading.CancellationToken -> System.Threading.Tasks.Task<obj>
<Extension()>
Public Function GetFromJsonAsync (client As HttpClient, requestUri As Uri, type As Type, context As JsonSerializerContext, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Object)

參數

client
HttpClient

用來傳送要求的用戶端。

requestUri
Uri

傳送要求的目標 URI。

type
Type

要還原序列化並傳回之物件的類型。

context
JsonSerializerContext

用來控制還原序列化行為的 JsonSerializerCoNtext。

cancellationToken
CancellationToken

取消語彙基元,可由其他物件或執行緒用來接收取消通知。

傳回

工作物件,表示非同步作業。

例外狀況

取消權杖已取消。 此例外狀況會儲存在傳回的工作中。

適用於

GetFromJsonAsync(HttpClient, Uri, Type, CancellationToken)

Source:
HttpClientJsonExtensions.Get.cs
Source:
HttpClientJsonExtensions.Get.cs
Source:
HttpClientJsonExtensions.Get.cs

將 GET 要求傳送至指定的 URI,並傳回在非同步作業中,將回應主體作為 JSON 還原序列化後所產生的值。

public static System.Threading.Tasks.Task<object?> GetFromJsonAsync (this System.Net.Http.HttpClient client, Uri? requestUri, Type type, System.Threading.CancellationToken cancellationToken = default);
static member GetFromJsonAsync : System.Net.Http.HttpClient * Uri * Type * System.Threading.CancellationToken -> System.Threading.Tasks.Task<obj>
<Extension()>
Public Function GetFromJsonAsync (client As HttpClient, requestUri As Uri, type As Type, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Object)

參數

client
HttpClient

用來傳送要求的用戶端。

requestUri
Uri

傳送要求的目標 URI。

type
Type

要還原序列化並傳回之物件的類型。

cancellationToken
CancellationToken

取消語彙基元,可由其他物件或執行緒用來接收取消通知。

傳回

工作物件,表示非同步作業。

例外狀況

取消權杖已取消。 此例外狀況會儲存在傳回的工作中。

備註

這個方法預設會使用 JsonSerializerDefaults.Web 還原序列化的選項,而 JsonSerializer 還原序列化方法預設不會。

適用於

GetFromJsonAsync(HttpClient, String, Type, CancellationToken)

Source:
HttpClientJsonExtensions.Get.cs
Source:
HttpClientJsonExtensions.Get.cs
Source:
HttpClientJsonExtensions.Get.cs

將 GET 要求傳送至指定的 URI,並傳回在非同步作業中,將回應主體作為 JSON 還原序列化後所產生的值。

public static System.Threading.Tasks.Task<object?> GetFromJsonAsync (this System.Net.Http.HttpClient client, string? requestUri, Type type, System.Threading.CancellationToken cancellationToken = default);
static member GetFromJsonAsync : System.Net.Http.HttpClient * string * Type * System.Threading.CancellationToken -> System.Threading.Tasks.Task<obj>
<Extension()>
Public Function GetFromJsonAsync (client As HttpClient, requestUri As String, type As Type, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Object)

參數

client
HttpClient

用來傳送要求的用戶端。

requestUri
String

傳送要求的目標 URI。

type
Type

要還原序列化並傳回之物件的類型。

cancellationToken
CancellationToken

取消語彙基元,可由其他物件或執行緒用來接收取消通知。

傳回

工作物件,表示非同步作業。

例外狀況

取消權杖已取消。 此例外狀況會儲存在傳回的工作中。

備註

這個方法預設會使用 JsonSerializerDefaults.Web 還原序列化的選項,而 JsonSerializer 還原序列化方法預設不會。

適用於

GetFromJsonAsync(HttpClient, String, Type, JsonSerializerOptions, CancellationToken)

Source:
HttpClientJsonExtensions.Get.cs
Source:
HttpClientJsonExtensions.Get.cs
Source:
HttpClientJsonExtensions.Get.cs

將 GET 要求傳送至指定的 URI,並傳回在非同步作業中,將回應主體作為 JSON 還原序列化後所產生的值。

public static System.Threading.Tasks.Task<object?> GetFromJsonAsync (this System.Net.Http.HttpClient client, string? requestUri, Type type, System.Text.Json.JsonSerializerOptions? options, System.Threading.CancellationToken cancellationToken = default);
static member GetFromJsonAsync : System.Net.Http.HttpClient * string * Type * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<obj>
<Extension()>
Public Function GetFromJsonAsync (client As HttpClient, requestUri As String, type As Type, options As JsonSerializerOptions, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Object)

參數

client
HttpClient

用來傳送要求的用戶端。

requestUri
String

傳送要求的目標 URI。

type
Type

要還原序列化並傳回之物件的類型。

options
JsonSerializerOptions

在還原序列化期間控制行為的選項。 預設選項是 Web 所指定的選項。

cancellationToken
CancellationToken

取消語彙基元,可由其他物件或執行緒用來接收取消通知。

傳回

工作物件,表示非同步作業。

例外狀況

取消權杖已取消。 此例外狀況會儲存在傳回的工作中。

適用於

GetFromJsonAsync<TValue>(HttpClient, String, CancellationToken)

Source:
HttpClientJsonExtensions.Get.cs
Source:
HttpClientJsonExtensions.Get.cs
Source:
HttpClientJsonExtensions.Get.cs

將 GET 要求傳送至指定的 URI,並傳回在非同步作業中,將回應主體作為 JSON 還原序列化後所產生的值。

public static System.Threading.Tasks.Task<TValue?> GetFromJsonAsync<TValue> (this System.Net.Http.HttpClient client, string? requestUri, System.Threading.CancellationToken cancellationToken = default);
static member GetFromJsonAsync : System.Net.Http.HttpClient * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'Value>
<Extension()>
Public Function GetFromJsonAsync(Of TValue) (client As HttpClient, requestUri As String, Optional cancellationToken As CancellationToken = Nothing) As Task(Of TValue)

類型參數

TValue

要還原序列化的目標型別。

參數

client
HttpClient

用來傳送要求的用戶端。

requestUri
String

傳送要求的目標 URI。

cancellationToken
CancellationToken

取消語彙基元,可由其他物件或執行緒用來接收取消通知。

傳回

Task<TValue>

工作物件,表示非同步作業。

例外狀況

取消權杖已取消。 此例外狀況會儲存在傳回的工作中。

備註

這個方法預設會使用 JsonSerializerDefaults.Web 還原序列化的選項,而 JsonSerializer 還原序列化方法預設不會。

適用於

GetFromJsonAsync<TValue>(HttpClient, Uri, CancellationToken)

Source:
HttpClientJsonExtensions.Get.cs
Source:
HttpClientJsonExtensions.Get.cs
Source:
HttpClientJsonExtensions.Get.cs

將 GET 要求傳送至指定的 URI,並傳回在非同步作業中,將回應主體作為 JSON 還原序列化後所產生的值。

public static System.Threading.Tasks.Task<TValue?> GetFromJsonAsync<TValue> (this System.Net.Http.HttpClient client, Uri? requestUri, System.Threading.CancellationToken cancellationToken = default);
static member GetFromJsonAsync : System.Net.Http.HttpClient * Uri * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'Value>
<Extension()>
Public Function GetFromJsonAsync(Of TValue) (client As HttpClient, requestUri As Uri, Optional cancellationToken As CancellationToken = Nothing) As Task(Of TValue)

類型參數

TValue

要還原序列化的目標型別。

參數

client
HttpClient

用來傳送要求的用戶端。

requestUri
Uri

傳送要求的目標 URI。

cancellationToken
CancellationToken

取消語彙基元,可由其他物件或執行緒用來接收取消通知。

傳回

Task<TValue>

工作物件,表示非同步作業。

例外狀況

取消權杖已取消。 此例外狀況會儲存在傳回的工作中。

備註

這個方法預設會使用 JsonSerializerDefaults.Web 還原序列化的選項,而 JsonSerializer 還原序列化方法預設不會。

適用於

GetFromJsonAsync<TValue>(HttpClient, String, JsonSerializerOptions, CancellationToken)

Source:
HttpClientJsonExtensions.Get.cs
Source:
HttpClientJsonExtensions.Get.cs
Source:
HttpClientJsonExtensions.Get.cs

將 GET 要求傳送至指定的 URI,並傳回在非同步作業中,將回應主體作為 JSON 還原序列化後所產生的值。

public static System.Threading.Tasks.Task<TValue?> GetFromJsonAsync<TValue> (this System.Net.Http.HttpClient client, string? requestUri, System.Text.Json.JsonSerializerOptions? options, System.Threading.CancellationToken cancellationToken = default);
static member GetFromJsonAsync : System.Net.Http.HttpClient * string * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'Value>
<Extension()>
Public Function GetFromJsonAsync(Of TValue) (client As HttpClient, requestUri As String, options As JsonSerializerOptions, Optional cancellationToken As CancellationToken = Nothing) As Task(Of TValue)

類型參數

TValue

要還原序列化的目標型別。

參數

client
HttpClient

用來傳送要求的用戶端。

requestUri
String

傳送要求的目標 URI。

options
JsonSerializerOptions

還原序列化期間控制行為的選項。 預設選項是 Web 所指定的選項。

cancellationToken
CancellationToken

取消語彙基元,可由其他物件或執行緒用來接收取消通知。

傳回

Task<TValue>

工作物件,表示非同步作業。

例外狀況

取消權杖已取消。 此例外狀況會儲存在傳回的工作中。

適用於

GetFromJsonAsync<TValue>(HttpClient, String, JsonTypeInfo<TValue>, CancellationToken)

Source:
HttpClientJsonExtensions.Get.cs
Source:
HttpClientJsonExtensions.Get.cs
Source:
HttpClientJsonExtensions.Get.cs

將 GET 要求傳送至指定的 URI,並傳回在非同步作業中,將回應主體作為 JSON 還原序列化後所產生的值。

public static System.Threading.Tasks.Task<TValue?> GetFromJsonAsync<TValue> (this System.Net.Http.HttpClient client, string? requestUri, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo, System.Threading.CancellationToken cancellationToken = default);
static member GetFromJsonAsync : System.Net.Http.HttpClient * string * System.Text.Json.Serialization.Metadata.JsonTypeInfo<'Value> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'Value>
<Extension()>
Public Function GetFromJsonAsync(Of TValue) (client As HttpClient, requestUri As String, jsonTypeInfo As JsonTypeInfo(Of TValue), Optional cancellationToken As CancellationToken = Nothing) As Task(Of TValue)

類型參數

TValue

要還原序列化的目標型別。

參數

client
HttpClient

用來傳送要求的用戶端。

requestUri
String

傳送要求的目標 URI。

jsonTypeInfo
JsonTypeInfo<TValue>

用來控制還原序列化行為的 JsonTypeInfo。

cancellationToken
CancellationToken

取消語彙基元,可由其他物件或執行緒用來接收取消通知。

傳回

Task<TValue>

工作物件,表示非同步作業。

例外狀況

解除標記已取消。 此例外狀況會儲存在傳回的工作中。

適用於

GetFromJsonAsync<TValue>(HttpClient, Uri, JsonSerializerOptions, CancellationToken)

Source:
HttpClientJsonExtensions.Get.cs
Source:
HttpClientJsonExtensions.Get.cs
Source:
HttpClientJsonExtensions.Get.cs

將 GET 要求傳送至指定的 URI,並傳回在非同步作業中,將回應主體作為 JSON 還原序列化後所產生的值。

public static System.Threading.Tasks.Task<TValue?> GetFromJsonAsync<TValue> (this System.Net.Http.HttpClient client, Uri? requestUri, System.Text.Json.JsonSerializerOptions? options, System.Threading.CancellationToken cancellationToken = default);
static member GetFromJsonAsync : System.Net.Http.HttpClient * Uri * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'Value>
<Extension()>
Public Function GetFromJsonAsync(Of TValue) (client As HttpClient, requestUri As Uri, options As JsonSerializerOptions, Optional cancellationToken As CancellationToken = Nothing) As Task(Of TValue)

類型參數

TValue

要還原序列化的目標型別。

參數

client
HttpClient

用來傳送要求的用戶端。

requestUri
Uri

傳送要求的目標 URI。

options
JsonSerializerOptions

還原序列化期間控制行為的選項。 預設選項是 Web 所指定的選項。

cancellationToken
CancellationToken

取消語彙基元,可由其他物件或執行緒用來接收取消通知。

傳回

Task<TValue>

工作物件,表示非同步作業。

例外狀況

解除標記已取消。 此例外狀況會儲存在傳回的工作中。

適用於

GetFromJsonAsync<TValue>(HttpClient, Uri, JsonTypeInfo<TValue>, CancellationToken)

Source:
HttpClientJsonExtensions.Get.cs
Source:
HttpClientJsonExtensions.Get.cs
Source:
HttpClientJsonExtensions.Get.cs

將 GET 要求傳送至指定的 URI,並傳回在非同步作業中,將回應主體作為 JSON 還原序列化後所產生的值。

public static System.Threading.Tasks.Task<TValue?> GetFromJsonAsync<TValue> (this System.Net.Http.HttpClient client, Uri? requestUri, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo, System.Threading.CancellationToken cancellationToken = default);
static member GetFromJsonAsync : System.Net.Http.HttpClient * Uri * System.Text.Json.Serialization.Metadata.JsonTypeInfo<'Value> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'Value>
<Extension()>
Public Function GetFromJsonAsync(Of TValue) (client As HttpClient, requestUri As Uri, jsonTypeInfo As JsonTypeInfo(Of TValue), Optional cancellationToken As CancellationToken = Nothing) As Task(Of TValue)

類型參數

TValue

要還原序列化的目標型別。

參數

client
HttpClient

用來傳送要求的用戶端。

requestUri
Uri

傳送要求的目標 URI。

jsonTypeInfo
JsonTypeInfo<TValue>

用來控制還原序列化行為的 JsonTypeInfo。

cancellationToken
CancellationToken

取消語彙基元,可由其他物件或執行緒用來接收取消通知。

傳回

Task<TValue>

工作物件,表示非同步作業。

例外狀況

解除標記已取消。 此例外狀況會儲存在傳回的工作中。

適用於