語言

HttpResponseJsonExtensions.WriteAsJsonAsync 方法

定義

多載

名稱 Description
WriteAsJsonAsync(HttpResponse, Object, Type, CancellationToken)

將指定的值當做 JSON 寫入回應本文。 回應內容類型將會設定為 application/json; charset=utf-8 。

WriteAsJsonAsync(HttpResponse, Object, JsonTypeInfo, String, CancellationToken)

將指定的值當做 JSON 寫入回應本文。 回應內容類型將會設定為指定的內容類型。

WriteAsJsonAsync(HttpResponse, Object, Type, JsonSerializerOptions, CancellationToken)

將指定的值當做 JSON 寫入回應本文。 回應內容類型將會設定為 application/json; charset=utf-8 。

WriteAsJsonAsync(HttpResponse, Object, Type, JsonSerializerOptions, String, CancellationToken)

將指定的值當做 JSON 寫入回應本文。 回應內容類型將會設定為指定的內容類型。

WriteAsJsonAsync(HttpResponse, Object, Type, JsonSerializerContext, String, CancellationToken)

將指定的值當做 JSON 寫入回應本文。 回應內容類型將會設定為指定的內容類型。

WriteAsJsonAsync<TValue>(HttpResponse, TValue, CancellationToken)

將指定的值當做 JSON 寫入回應本文。 回應內容類型將會設定為 application/json; charset=utf-8 。

WriteAsJsonAsync<TValue>(HttpResponse, TValue, JsonSerializerOptions, CancellationToken)

將指定的值當做 JSON 寫入回應本文。 回應內容類型將會設定為 application/json; charset=utf-8 。

WriteAsJsonAsync<TValue>(HttpResponse, TValue, JsonSerializerOptions, String, CancellationToken)

將指定的值當做 JSON 寫入回應本文。 回應內容類型將會設定為指定的內容類型。

WriteAsJsonAsync<TValue>(HttpResponse, TValue, JsonTypeInfo<TValue>, String, CancellationToken)

將指定的值當做 JSON 寫入回應本文。 回應內容類型將會設定為指定的內容類型。

WriteAsJsonAsync(HttpResponse, Object, Type, CancellationToken)

來源:
HttpResponseJsonExtensions.cs

將指定的值當做 JSON 寫入回應本文。 回應內容類型將會設定為 application/json; charset=utf-8 。

public static System.Threading.Tasks.Task WriteAsJsonAsync(this Microsoft.AspNetCore.Http.HttpResponse response, object? value, Type type, System.Threading.CancellationToken cancellationToken = default);
static member WriteAsJsonAsync : Microsoft.AspNetCore.Http.HttpResponse * obj * Type * System.Threading.CancellationToken -> System.Threading.Tasks.Task
<Extension()>
Public Function WriteAsJsonAsync (response As HttpResponse, value As Object, type As Type, Optional cancellationToken As CancellationToken = Nothing) As Task

參數

response
HttpResponse

要寫入 JSON 的回應。

value
Object

要寫入為 JSON 的值。

type
Type

要寫入之物件的類型。

cancellationToken
CancellationToken

, CancellationToken 用來取消作業。

傳回

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

適用於

WriteAsJsonAsync(HttpResponse, Object, JsonTypeInfo, String, CancellationToken)

來源:
HttpResponseJsonExtensions.cs

將指定的值當做 JSON 寫入回應本文。 回應內容類型將會設定為指定的內容類型。

public static System.Threading.Tasks.Task WriteAsJsonAsync(this Microsoft.AspNetCore.Http.HttpResponse response, object? value, System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo, string? contentType = default, System.Threading.CancellationToken cancellationToken = default);
static member WriteAsJsonAsync : Microsoft.AspNetCore.Http.HttpResponse * obj * System.Text.Json.Serialization.Metadata.JsonTypeInfo * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task
<Extension()>
Public Function WriteAsJsonAsync (response As HttpResponse, value As Object, jsonTypeInfo As JsonTypeInfo, Optional contentType As String = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task

參數

response
HttpResponse

要寫入 JSON 的回應。

value
Object

要寫入為 JSON 的值。

jsonTypeInfo
JsonTypeInfo

要轉換之型別的相關中繼資料。

contentType
String

回應上要設定的內容類型。

cancellationToken
CancellationToken

, CancellationToken 用來取消作業。

傳回

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

適用於

WriteAsJsonAsync(HttpResponse, Object, Type, JsonSerializerOptions, CancellationToken)

來源:
HttpResponseJsonExtensions.cs

將指定的值當做 JSON 寫入回應本文。 回應內容類型將會設定為 application/json; charset=utf-8 。

public static System.Threading.Tasks.Task WriteAsJsonAsync(this Microsoft.AspNetCore.Http.HttpResponse response, object? value, Type type, System.Text.Json.JsonSerializerOptions? options, System.Threading.CancellationToken cancellationToken = default);
static member WriteAsJsonAsync : Microsoft.AspNetCore.Http.HttpResponse * obj * Type * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task
<Extension()>
Public Function WriteAsJsonAsync (response As HttpResponse, value As Object, type As Type, options As JsonSerializerOptions, Optional cancellationToken As CancellationToken = Nothing) As Task

參數

response
HttpResponse

要寫入 JSON 的回應。

value
Object

要寫入為 JSON 的值。

type
Type

要寫入之物件的類型。

options
JsonSerializerOptions

序列化值時要使用的序列化程式選項。

cancellationToken
CancellationToken

, CancellationToken 用來取消作業。

傳回

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

適用於

WriteAsJsonAsync(HttpResponse, Object, Type, JsonSerializerOptions, String, CancellationToken)

來源:
HttpResponseJsonExtensions.cs

將指定的值當做 JSON 寫入回應本文。 回應內容類型將會設定為指定的內容類型。

public static System.Threading.Tasks.Task WriteAsJsonAsync(this Microsoft.AspNetCore.Http.HttpResponse response, object? value, Type type, System.Text.Json.JsonSerializerOptions? options, string? contentType, System.Threading.CancellationToken cancellationToken = default);
static member WriteAsJsonAsync : Microsoft.AspNetCore.Http.HttpResponse * obj * Type * System.Text.Json.JsonSerializerOptions * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task
<Extension()>
Public Function WriteAsJsonAsync (response As HttpResponse, value As Object, type As Type, options As JsonSerializerOptions, contentType As String, Optional cancellationToken As CancellationToken = Nothing) As Task

參數

response
HttpResponse

要寫入 JSON 的回應。

value
Object

要寫入為 JSON 的值。

type
Type

要寫入之物件的類型。

options
JsonSerializerOptions

序列化值時要使用的序列化程式選項。

contentType
String

回應上要設定的內容類型。

cancellationToken
CancellationToken

, CancellationToken 用來取消作業。

傳回

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

適用於

WriteAsJsonAsync(HttpResponse, Object, Type, JsonSerializerContext, String, CancellationToken)

來源:
HttpResponseJsonExtensions.cs

將指定的值當做 JSON 寫入回應本文。 回應內容類型將會設定為指定的內容類型。

public static System.Threading.Tasks.Task WriteAsJsonAsync(this Microsoft.AspNetCore.Http.HttpResponse response, object? value, Type type, System.Text.Json.Serialization.JsonSerializerContext context, string? contentType = default, System.Threading.CancellationToken cancellationToken = default);
static member WriteAsJsonAsync : Microsoft.AspNetCore.Http.HttpResponse * obj * Type * System.Text.Json.Serialization.JsonSerializerContext * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task
<Extension()>
Public Function WriteAsJsonAsync (response As HttpResponse, value As Object, type As Type, context As JsonSerializerContext, Optional contentType As String = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task

參數

response
HttpResponse

要寫入 JSON 的回應。

value
Object

要寫入為 JSON 的值。

type
Type

要寫入之物件的類型。

context
JsonSerializerContext

可序列化類型的中繼資料提供者。

contentType
String

回應上要設定的內容類型。

cancellationToken
CancellationToken

, CancellationToken 用來取消作業。

傳回

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

適用於

WriteAsJsonAsync<TValue>(HttpResponse, TValue, CancellationToken)

來源:
HttpResponseJsonExtensions.cs

將指定的值當做 JSON 寫入回應本文。 回應內容類型將會設定為 application/json; charset=utf-8 。

public static System.Threading.Tasks.Task WriteAsJsonAsync<TValue>(this Microsoft.AspNetCore.Http.HttpResponse response, TValue value, System.Threading.CancellationToken cancellationToken = default);
static member WriteAsJsonAsync : Microsoft.AspNetCore.Http.HttpResponse * 'Value * System.Threading.CancellationToken -> System.Threading.Tasks.Task
<Extension()>
Public Function WriteAsJsonAsync(Of TValue) (response As HttpResponse, value As TValue, Optional cancellationToken As CancellationToken = Nothing) As Task

類型參數

TValue

要寫入之物件的類型。

參數

response
HttpResponse

要寫入 JSON 的回應。

value
TValue

要寫入為 JSON 的值。

cancellationToken
CancellationToken

, CancellationToken 用來取消作業。

傳回

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

適用於

WriteAsJsonAsync<TValue>(HttpResponse, TValue, JsonSerializerOptions, CancellationToken)

來源:
HttpResponseJsonExtensions.cs

將指定的值當做 JSON 寫入回應本文。 回應內容類型將會設定為 application/json; charset=utf-8 。

public static System.Threading.Tasks.Task WriteAsJsonAsync<TValue>(this Microsoft.AspNetCore.Http.HttpResponse response, TValue value, System.Text.Json.JsonSerializerOptions? options, System.Threading.CancellationToken cancellationToken = default);
static member WriteAsJsonAsync : Microsoft.AspNetCore.Http.HttpResponse * 'Value * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task
<Extension()>
Public Function WriteAsJsonAsync(Of TValue) (response As HttpResponse, value As TValue, options As JsonSerializerOptions, Optional cancellationToken As CancellationToken = Nothing) As Task

類型參數

TValue

要寫入之物件的類型。

參數

response
HttpResponse

要寫入 JSON 的回應。

value
TValue

要寫入為 JSON 的值。

options
JsonSerializerOptions

序列化值時要使用的序列化程式選項。

cancellationToken
CancellationToken

, CancellationToken 用來取消作業。

傳回

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

適用於

WriteAsJsonAsync<TValue>(HttpResponse, TValue, JsonSerializerOptions, String, CancellationToken)

來源:
HttpResponseJsonExtensions.cs

將指定的值當做 JSON 寫入回應本文。 回應內容類型將會設定為指定的內容類型。

public static System.Threading.Tasks.Task WriteAsJsonAsync<TValue>(this Microsoft.AspNetCore.Http.HttpResponse response, TValue value, System.Text.Json.JsonSerializerOptions? options, string? contentType, System.Threading.CancellationToken cancellationToken = default);
static member WriteAsJsonAsync : Microsoft.AspNetCore.Http.HttpResponse * 'Value * System.Text.Json.JsonSerializerOptions * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task
<Extension()>
Public Function WriteAsJsonAsync(Of TValue) (response As HttpResponse, value As TValue, options As JsonSerializerOptions, contentType As String, Optional cancellationToken As CancellationToken = Nothing) As Task

類型參數

TValue

要寫入之物件的類型。

參數

response
HttpResponse

要寫入 JSON 的回應。

value
TValue

要寫入為 JSON 的值。

options
JsonSerializerOptions

序列化值時要使用的序列化程式選項。

contentType
String

回應上要設定的內容類型。

cancellationToken
CancellationToken

, CancellationToken 用來取消作業。

傳回

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

適用於

WriteAsJsonAsync<TValue>(HttpResponse, TValue, JsonTypeInfo<TValue>, String, CancellationToken)

來源:
HttpResponseJsonExtensions.cs

將指定的值當做 JSON 寫入回應本文。 回應內容類型將會設定為指定的內容類型。

public static System.Threading.Tasks.Task WriteAsJsonAsync<TValue>(this Microsoft.AspNetCore.Http.HttpResponse response, TValue value, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo, string? contentType = default, System.Threading.CancellationToken cancellationToken = default);
static member WriteAsJsonAsync : Microsoft.AspNetCore.Http.HttpResponse * 'Value * System.Text.Json.Serialization.Metadata.JsonTypeInfo<'Value> * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task
<Extension()>
Public Function WriteAsJsonAsync(Of TValue) (response As HttpResponse, value As TValue, jsonTypeInfo As JsonTypeInfo(Of TValue), Optional contentType As String = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task

類型參數

TValue

要寫入之物件的類型。

參數

response
HttpResponse

要寫入 JSON 的回應。

value
TValue

要寫入為 JSON 的值。

jsonTypeInfo
JsonTypeInfo<TValue>

要轉換之型別的相關中繼資料。

contentType
String

回應上要設定的內容類型。

cancellationToken
CancellationToken

, CancellationToken 用來取消作業。

傳回

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

適用於