HttpContentJsonExtensions.ReadFromJsonAsync 方法

定義

多載

ReadFromJsonAsync(HttpContent, Type, CancellationToken)

讀取 HTTP 內容,並傳回在非同步作業中將內容作為 JSON 還原序列化後所產生的值。

ReadFromJsonAsync(HttpContent, Type, JsonSerializerOptions, CancellationToken)

讀取 HTTP 內容,並傳回在非同步作業中將內容作為 JSON 還原序列化後所產生的值。

ReadFromJsonAsync(HttpContent, Type, JsonSerializerContext, CancellationToken)

讀取 HTTP 內容,並傳回在非同步作業中將內容作為 JSON 還原序列化後所產生的值。

ReadFromJsonAsync<T>(HttpContent, CancellationToken)

讀取 HTTP 內容,並傳回在非同步作業中將內容作為 JSON 還原序列化後所產生的值。

ReadFromJsonAsync<T>(HttpContent, JsonSerializerOptions, CancellationToken)

讀取 HTTP 內容,並傳回在非同步作業中將內容作為 JSON 還原序列化後所產生的值。

ReadFromJsonAsync<T>(HttpContent, JsonTypeInfo<T>, CancellationToken)

讀取 HTTP 內容,並傳回在非同步作業中將內容作為 JSON 還原序列化後所產生的值。

ReadFromJsonAsync(HttpContent, Type, CancellationToken)

讀取 HTTP 內容,並傳回在非同步作業中將內容作為 JSON 還原序列化後所產生的值。

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

參數

content
HttpContent

要從中讀取的內容。

type
Type

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

cancellationToken
CancellationToken

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

傳回

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

例外狀況

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

適用於

ReadFromJsonAsync(HttpContent, Type, JsonSerializerOptions, CancellationToken)

讀取 HTTP 內容,並傳回在非同步作業中將內容作為 JSON 還原序列化後所產生的值。

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

參數

content
HttpContent

要從中讀取的內容。

type
Type

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

options
JsonSerializerOptions

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

cancellationToken
CancellationToken

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

傳回

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

例外狀況

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

適用於

ReadFromJsonAsync(HttpContent, Type, JsonSerializerContext, CancellationToken)

讀取 HTTP 內容,並傳回在非同步作業中將內容作為 JSON 還原序列化後所產生的值。

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

參數

content
HttpContent

要從中讀取的內容。

type
Type

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

context
JsonSerializerContext

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

cancellationToken
CancellationToken

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

傳回

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

例外狀況

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

適用於

ReadFromJsonAsync<T>(HttpContent, CancellationToken)

讀取 HTTP 內容,並傳回在非同步作業中將內容作為 JSON 還原序列化後所產生的值。

public static System.Threading.Tasks.Task<T?> ReadFromJsonAsync<T> (this System.Net.Http.HttpContent content, System.Threading.CancellationToken cancellationToken = default);
static member ReadFromJsonAsync : System.Net.Http.HttpContent * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'T>
<Extension()>
Public Function ReadFromJsonAsync(Of T) (content As HttpContent, Optional cancellationToken As CancellationToken = Nothing) As Task(Of T)

類型參數

T

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

參數

content
HttpContent

要從中讀取的內容。

cancellationToken
CancellationToken

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

傳回

Task<T>

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

例外狀況

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

適用於

ReadFromJsonAsync<T>(HttpContent, JsonSerializerOptions, CancellationToken)

讀取 HTTP 內容,並傳回在非同步作業中將內容作為 JSON 還原序列化後所產生的值。

public static System.Threading.Tasks.Task<T?> ReadFromJsonAsync<T> (this System.Net.Http.HttpContent content, System.Text.Json.JsonSerializerOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
public static System.Threading.Tasks.Task<T?> ReadFromJsonAsync<T> (this System.Net.Http.HttpContent content, System.Text.Json.JsonSerializerOptions? options, System.Threading.CancellationToken cancellationToken = default);
static member ReadFromJsonAsync : System.Net.Http.HttpContent * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'T>
<Extension()>
Public Function ReadFromJsonAsync(Of T) (content As HttpContent, Optional options As JsonSerializerOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of T)
<Extension()>
Public Function ReadFromJsonAsync(Of T) (content As HttpContent, options As JsonSerializerOptions, Optional cancellationToken As CancellationToken = Nothing) As Task(Of T)

類型參數

T

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

參數

content
HttpContent

要從中讀取的內容。

options
JsonSerializerOptions

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

cancellationToken
CancellationToken

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

傳回

Task<T>

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

例外狀況

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

適用於

ReadFromJsonAsync<T>(HttpContent, JsonTypeInfo<T>, CancellationToken)

讀取 HTTP 內容,並傳回在非同步作業中將內容作為 JSON 還原序列化後所產生的值。

public static System.Threading.Tasks.Task<T?> ReadFromJsonAsync<T> (this System.Net.Http.HttpContent content, System.Text.Json.Serialization.Metadata.JsonTypeInfo<T> jsonTypeInfo, System.Threading.CancellationToken cancellationToken = default);
static member ReadFromJsonAsync : System.Net.Http.HttpContent * System.Text.Json.Serialization.Metadata.JsonTypeInfo<'T> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'T>
<Extension()>
Public Function ReadFromJsonAsync(Of T) (content As HttpContent, jsonTypeInfo As JsonTypeInfo(Of T), Optional cancellationToken As CancellationToken = Nothing) As Task(Of T)

類型參數

T

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

參數

content
HttpContent

要從中讀取的內容。

jsonTypeInfo
JsonTypeInfo<T>

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

cancellationToken
CancellationToken

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

傳回

Task<T>

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

例外狀況

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

適用於