JsonSerializer.SerializeToUtf8Bytes Méthode

Définition

Surcharges

Nom Description
SerializeToUtf8Bytes(Object, JsonTypeInfo)

Convertit la valeur fournie en tableau Byte .

SerializeToUtf8Bytes(Object, Type, JsonSerializerOptions)

Convertit une valeur du type spécifié en chaîne JSON, encodée en octets UTF-8.

SerializeToUtf8Bytes(Object, Type, JsonSerializerContext)

Convertit la valeur fournie en tableau Byte .

SerializeToUtf8Bytes<TValue>(TValue, JsonSerializerOptions)

Convertit la valeur d’un type spécifié par un paramètre de type générique en chaîne JSON, encodée en UTF-8 octets.

SerializeToUtf8Bytes<TValue>(TValue, JsonTypeInfo<TValue>)

Convertit la valeur fournie en tableau Byte .

SerializeToUtf8Bytes(Object, JsonTypeInfo)

Source:
JsonSerializer.Write.ByteArray.cs
Source:
JsonSerializer.Write.ByteArray.cs
Source:
JsonSerializer.Write.ByteArray.cs
Source:
JsonSerializer.Write.ByteArray.cs
Source:
JsonSerializer.Write.ByteArray.cs
Source:
JsonSerializer.Write.ByteArray.cs

Convertit la valeur fournie en tableau Byte .

public:
 static cli::array <System::Byte> ^ SerializeToUtf8Bytes(System::Object ^ value, System::Text::Json::Serialization::Metadata::JsonTypeInfo ^ jsonTypeInfo);
public static byte[] SerializeToUtf8Bytes(object? value, System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo);
static member SerializeToUtf8Bytes : obj * System.Text.Json.Serialization.Metadata.JsonTypeInfo -> byte[]
Public Function SerializeToUtf8Bytes (value As Object, jsonTypeInfo As JsonTypeInfo) As Byte()

Paramètres

value
Object

Valeur à convertir.

jsonTypeInfo
JsonTypeInfo

Métadonnées sur le type à convertir.

Retours

Byte[]

Représentation UTF-8 de la valeur.

Exceptions

jsonTypeInfo a la valeur null.

value ne correspond pas au type de jsonTypeInfo.

S’applique à

SerializeToUtf8Bytes(Object, Type, JsonSerializerOptions)

Source:
JsonSerializer.Write.ByteArray.cs
Source:
JsonSerializer.Write.ByteArray.cs
Source:
JsonSerializer.Write.ByteArray.cs
Source:
JsonSerializer.Write.ByteArray.cs
Source:
JsonSerializer.Write.ByteArray.cs
Source:
JsonSerializer.Write.ByteArray.cs
Source:
JsonSerializer.Write.ByteArray.cs

Convertit une valeur du type spécifié en chaîne JSON, encodée en octets UTF-8.

[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
public static byte[] SerializeToUtf8Bytes(object? value, Type inputType, System.Text.Json.JsonSerializerOptions? options = default);
public static byte[] SerializeToUtf8Bytes(object? value, Type inputType, System.Text.Json.JsonSerializerOptions? options = default);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
public static byte[] SerializeToUtf8Bytes(object? value, Type inputType, System.Text.Json.JsonSerializerOptions? options = default);
public static byte[] SerializeToUtf8Bytes(object value, Type inputType, System.Text.Json.JsonSerializerOptions options = default);
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")>]
static member SerializeToUtf8Bytes : obj * Type * System.Text.Json.JsonSerializerOptions -> byte[]
static member SerializeToUtf8Bytes : obj * Type * System.Text.Json.JsonSerializerOptions -> byte[]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")>]
static member SerializeToUtf8Bytes : obj * Type * System.Text.Json.JsonSerializerOptions -> byte[]
Public Function SerializeToUtf8Bytes (value As Object, inputType As Type, Optional options As JsonSerializerOptions = Nothing) As Byte()
Public Shared Function SerializeToUtf8Bytes (value As Object, inputType As Type, Optional options As JsonSerializerOptions = Nothing) As Byte()

Paramètres

value
Object

Valeur à convertir.

inputType
Type

Type de la value conversion.

options
JsonSerializerOptions

Options permettant de contrôler le comportement de conversion.

Retours

Byte[]

Représentation sous forme de chaîne JSON de la valeur, encodée en UTF-8 octets.

Attributs

Exceptions

inputType n’est pas compatible avec value.

inputType a la valeur null.

Il n’existe aucune compatibilité JsonConverter pour inputType ses membres sérialisables.

Remarques

Pour plus d’informations, consultez Comment sérialiser et désérialiser JSON.

S’applique à

SerializeToUtf8Bytes(Object, Type, JsonSerializerContext)

Source:
JsonSerializer.Write.ByteArray.cs
Source:
JsonSerializer.Write.ByteArray.cs
Source:
JsonSerializer.Write.ByteArray.cs
Source:
JsonSerializer.Write.ByteArray.cs
Source:
JsonSerializer.Write.ByteArray.cs
Source:
JsonSerializer.Write.ByteArray.cs
Source:
JsonSerializer.Write.ByteArray.cs

Convertit la valeur fournie en tableau Byte .

public:
 static cli::array <System::Byte> ^ SerializeToUtf8Bytes(System::Object ^ value, Type ^ inputType, System::Text::Json::Serialization::JsonSerializerContext ^ context);
public static byte[] SerializeToUtf8Bytes(object? value, Type inputType, System.Text.Json.Serialization.JsonSerializerContext context);
static member SerializeToUtf8Bytes : obj * Type * System.Text.Json.Serialization.JsonSerializerContext -> byte[]
Public Function SerializeToUtf8Bytes (value As Object, inputType As Type, context As JsonSerializerContext) As Byte()

Paramètres

value
Object

Valeur à convertir.

inputType
Type

Type de la value conversion.

context
JsonSerializerContext

Fournisseur de métadonnées pour les types sérialisables.

Retours

Byte[]

Représentation UTF-8 de la valeur.

Exceptions

inputType n’est pas compatible avec value.

inputType a la valeur null.

Il n’existe aucune compatibilité JsonConverter pour inputType ses membres sérialisables.

Méthode GetTypeInfo(Type) des retours null fournis context pour le type à convertir.

S’applique à

SerializeToUtf8Bytes<TValue>(TValue, JsonSerializerOptions)

Source:
JsonSerializer.Write.ByteArray.cs
Source:
JsonSerializer.Write.ByteArray.cs
Source:
JsonSerializer.Write.ByteArray.cs
Source:
JsonSerializer.Write.ByteArray.cs
Source:
JsonSerializer.Write.ByteArray.cs
Source:
JsonSerializer.Write.ByteArray.cs
Source:
JsonSerializer.Write.ByteArray.cs

Convertit la valeur d’un type spécifié par un paramètre de type générique en chaîne JSON, encodée en UTF-8 octets.

[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
public static byte[] SerializeToUtf8Bytes<TValue>(TValue value, System.Text.Json.JsonSerializerOptions? options = default);
public static byte[] SerializeToUtf8Bytes<TValue>(TValue value, System.Text.Json.JsonSerializerOptions? options = default);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
public static byte[] SerializeToUtf8Bytes<TValue>(TValue value, System.Text.Json.JsonSerializerOptions? options = default);
public static byte[] SerializeToUtf8Bytes<TValue>(TValue value, System.Text.Json.JsonSerializerOptions options = default);
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")>]
static member SerializeToUtf8Bytes : 'Value * System.Text.Json.JsonSerializerOptions -> byte[]
static member SerializeToUtf8Bytes : 'Value * System.Text.Json.JsonSerializerOptions -> byte[]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")>]
static member SerializeToUtf8Bytes : 'Value * System.Text.Json.JsonSerializerOptions -> byte[]
Public Function SerializeToUtf8Bytes(Of TValue) (value As TValue, Optional options As JsonSerializerOptions = Nothing) As Byte()
Public Shared Function SerializeToUtf8Bytes(Of TValue) (value As TValue, Optional options As JsonSerializerOptions = Nothing) As Byte()

Paramètres de type

TValue

Type de la valeur.

Paramètres

value
TValue

Valeur à convertir.

options
JsonSerializerOptions

Options permettant de contrôler le comportement de conversion.

Retours

Byte[]

Représentation sous forme de chaîne JSON de la valeur, encodée en UTF-8 octets.

Attributs

Exceptions

Il n’existe aucune compatibilité JsonConverter pour TValue ses membres sérialisables.

Remarques

Pour plus d’informations, consultez Comment sérialiser et désérialiser JSON.

S’applique à

SerializeToUtf8Bytes<TValue>(TValue, JsonTypeInfo<TValue>)

Source:
JsonSerializer.Write.ByteArray.cs
Source:
JsonSerializer.Write.ByteArray.cs
Source:
JsonSerializer.Write.ByteArray.cs
Source:
JsonSerializer.Write.ByteArray.cs
Source:
JsonSerializer.Write.ByteArray.cs
Source:
JsonSerializer.Write.ByteArray.cs
Source:
JsonSerializer.Write.ByteArray.cs

Convertit la valeur fournie en tableau Byte .

public:
generic <typename TValue>
 static cli::array <System::Byte> ^ SerializeToUtf8Bytes(TValue value, System::Text::Json::Serialization::Metadata::JsonTypeInfo<TValue> ^ jsonTypeInfo);
public static byte[] SerializeToUtf8Bytes<TValue>(TValue value, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo);
static member SerializeToUtf8Bytes : 'Value * System.Text.Json.Serialization.Metadata.JsonTypeInfo<'Value> -> byte[]
Public Function SerializeToUtf8Bytes(Of TValue) (value As TValue, jsonTypeInfo As JsonTypeInfo(Of TValue)) As Byte()

Paramètres de type

TValue

Type de la valeur à sérialiser.

Paramètres

value
TValue

Valeur à convertir.

jsonTypeInfo
JsonTypeInfo<TValue>

Métadonnées sur le type à convertir.

Retours

Byte[]

Représentation UTF-8 de la valeur.

Exceptions

Il n’existe aucune compatibilité JsonConverter pour TValue ses membres sérialisables.

jsonTypeInfo a la valeur null.

S’applique à