共用方式為


JsonSerializer.SerializeToElement 方法

定義

多載

SerializeToElement(Object, Type, JsonSerializerContext)

將提供的值轉換成 JsonElement

SerializeToElement(Object, JsonTypeInfo)

將提供的值轉換成 JsonElement

SerializeToElement(Object, Type, JsonSerializerOptions)

將提供的值轉換成 JsonElement

SerializeToElement<TValue>(TValue, JsonSerializerOptions)

將提供的值轉換成 JsonElement

SerializeToElement<TValue>(TValue, JsonTypeInfo<TValue>)

將提供的值轉換成 JsonElement

SerializeToElement(Object, Type, JsonSerializerContext)

來源:
JsonSerializer.Write.Element.cs
來源:
JsonSerializer.Write.Element.cs
來源:
JsonSerializer.Write.Element.cs

將提供的值轉換成 JsonElement

public:
 static System::Text::Json::JsonElement SerializeToElement(System::Object ^ value, Type ^ inputType, System::Text::Json::Serialization::JsonSerializerContext ^ context);
public static System.Text.Json.JsonElement SerializeToElement (object? value, Type inputType, System.Text.Json.Serialization.JsonSerializerContext context);
static member SerializeToElement : obj * Type * System.Text.Json.Serialization.JsonSerializerContext -> System.Text.Json.JsonElement
Public Function SerializeToElement (value As Object, inputType As Type, context As JsonSerializerContext) As JsonElement

參數

value
Object

要轉換的值。

inputType
Type

要轉換的 value 型別。

context
JsonSerializerContext

可串行化類型的元數據提供者。

傳回

值的 JsonElement 表示法。

例外狀況

inputType 或其可串行化成員沒有相容的 JsonConverter

所提供 contextGetTypeInfo(Type) 方法會傳回要轉換之型別的 null

inputTypecontextnull

適用於

SerializeToElement(Object, JsonTypeInfo)

來源:
JsonSerializer.Write.Element.cs
來源:
JsonSerializer.Write.Element.cs

將提供的值轉換成 JsonElement

public:
 static System::Text::Json::JsonElement SerializeToElement(System::Object ^ value, System::Text::Json::Serialization::Metadata::JsonTypeInfo ^ jsonTypeInfo);
public static System.Text.Json.JsonElement SerializeToElement (object? value, System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo);
static member SerializeToElement : obj * System.Text.Json.Serialization.Metadata.JsonTypeInfo -> System.Text.Json.JsonElement
Public Function SerializeToElement (value As Object, jsonTypeInfo As JsonTypeInfo) As JsonElement

參數

value
Object

要轉換的值。

jsonTypeInfo
JsonTypeInfo

要轉換之型別的相關元數據。

傳回

值的 JsonElement 表示法。

例外狀況

jsonTypeInfo null

valuejsonTypeInfo的類型不相符。

適用於

SerializeToElement(Object, Type, JsonSerializerOptions)

來源:
JsonSerializer.Write.Element.cs
來源:
JsonSerializer.Write.Element.cs
來源:
JsonSerializer.Write.Element.cs

將提供的值轉換成 JsonElement

public static System.Text.Json.JsonElement SerializeToElement (object? value, Type inputType, System.Text.Json.JsonSerializerOptions? options = default);
static member SerializeToElement : obj * Type * System.Text.Json.JsonSerializerOptions -> System.Text.Json.JsonElement
Public Function SerializeToElement (value As Object, inputType As Type, Optional options As JsonSerializerOptions = Nothing) As JsonElement

參數

value
Object

要轉換的值。

inputType
Type

要轉換的 value 型別。

options
JsonSerializerOptions

控制轉換行為的選項。

傳回

值的 JsonElement 表示法。

例外狀況

inputTypevalue不相容。

inputType null

inputType 或其可串行化成員沒有相容的 JsonConverter

適用於

SerializeToElement<TValue>(TValue, JsonSerializerOptions)

來源:
JsonSerializer.Write.Element.cs
來源:
JsonSerializer.Write.Element.cs
來源:
JsonSerializer.Write.Element.cs

將提供的值轉換成 JsonElement

public static System.Text.Json.JsonElement SerializeToElement<TValue> (TValue value, System.Text.Json.JsonSerializerOptions? options = default);
static member SerializeToElement : 'Value * System.Text.Json.JsonSerializerOptions -> System.Text.Json.JsonElement
Public Function SerializeToElement(Of TValue) (value As TValue, Optional options As JsonSerializerOptions = Nothing) As JsonElement

類型參數

TValue

要串行化之值的型別。

參數

value
TValue

要轉換的值。

options
JsonSerializerOptions

控制轉換行為的選項。

傳回

JSON 值的 JsonElement 表示法。

例外狀況

TValue 或其可串行化成員沒有相容的 JsonConverter

適用於

SerializeToElement<TValue>(TValue, JsonTypeInfo<TValue>)

來源:
JsonSerializer.Write.Element.cs
來源:
JsonSerializer.Write.Element.cs
來源:
JsonSerializer.Write.Element.cs

將提供的值轉換成 JsonElement

public:
generic <typename TValue>
 static System::Text::Json::JsonElement SerializeToElement(TValue value, System::Text::Json::Serialization::Metadata::JsonTypeInfo<TValue> ^ jsonTypeInfo);
public static System.Text.Json.JsonElement SerializeToElement<TValue> (TValue value, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo);
static member SerializeToElement : 'Value * System.Text.Json.Serialization.Metadata.JsonTypeInfo<'Value> -> System.Text.Json.JsonElement
Public Function SerializeToElement(Of TValue) (value As TValue, jsonTypeInfo As JsonTypeInfo(Of TValue)) As JsonElement

類型參數

TValue

要串行化之值的型別。

參數

value
TValue

要轉換的值。

jsonTypeInfo
JsonTypeInfo<TValue>

要轉換之型別的相關元數據。

傳回

值的 JsonElement 表示法。

例外狀況

TValue 或其可串行化成員沒有相容的 JsonConverter

jsonTypeInfo null

適用於