JsonSerializer.SerializeToUtf8Bytes Méthode

Définition

Surcharges

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 octets UTF-8.

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

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

La valeur à convertir.

jsonTypeInfo
JsonTypeInfo

Métadonnées relatives au 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

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

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);
static member SerializeToUtf8Bytes : obj * Type * System.Text.Json.JsonSerializerOptions -> byte[]
Public Shared Function SerializeToUtf8Bytes (value As Object, inputType As Type, Optional options As JsonSerializerOptions = Nothing) As Byte()
Public 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 value à convertir.

options
JsonSerializerOptions

Options pour contrôler le comportement de conversion.

Retours

Byte[]

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

Exceptions

inputType n'est pas compatible avec value.

inputType a la valeur null.

Il n’existe pas de JsonConverter compatible pour inputType ou 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

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 value à convertir.

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 pas de JsonConverter compatible pour inputType ou ses membres sérialisables.

La GetTypeInfo(Type) méthode du fourni context retourne null le type à convertir.

S’applique à

SerializeToUtf8Bytes<TValue>(TValue, JsonSerializerOptions)

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 octets UTF-8.

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);
static member SerializeToUtf8Bytes : 'Value * System.Text.Json.JsonSerializerOptions -> byte[]
Public Shared Function SerializeToUtf8Bytes(Of TValue) (value As TValue, Optional options As JsonSerializerOptions = Nothing) As Byte()
Public 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 pour contrôler le comportement de conversion.

Retours

Byte[]

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

Exceptions

Il n’existe pas de JsonConverter compatible pour TValue ou 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

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

La valeur à convertir.

jsonTypeInfo
JsonTypeInfo<TValue>

Métadonnées relatives au type à convertir.

Retours

Byte[]

Représentation UTF-8 de la valeur.

Exceptions

Il n’existe pas de JsonConverter compatible pour TValue ou ses membres sérialisables.

jsonTypeInfo a la valeur null.

S’applique à