JsonSerializer.SerializeToUtf8Bytes Metod

Definition

Överlagringar

Name Description
SerializeToUtf8Bytes(Object, JsonTypeInfo)

Konverterar det angivna värdet till en Byte matris.

SerializeToUtf8Bytes(Object, Type, JsonSerializerOptions)

Konverterar ett värde av den angivna typen till en JSON-sträng, kodad som UTF-8 byte.

SerializeToUtf8Bytes(Object, Type, JsonSerializerContext)

Konverterar det angivna värdet till en Byte matris.

SerializeToUtf8Bytes<TValue>(TValue, JsonSerializerOptions)

Konverterar värdet för en typ som anges av en allmän typparameter till en JSON-sträng, kodad som UTF-8 byte.

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

Konverterar det angivna värdet till en Byte matris.

SerializeToUtf8Bytes(Object, JsonTypeInfo)

Källa:
JsonSerializer.Write.ByteArray.cs
Källa:
JsonSerializer.Write.ByteArray.cs
Källa:
JsonSerializer.Write.ByteArray.cs
Källa:
JsonSerializer.Write.ByteArray.cs
Källa:
JsonSerializer.Write.ByteArray.cs
Källa:
JsonSerializer.Write.ByteArray.cs

Konverterar det angivna värdet till en Byte matris.

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()

Parametrar

value
Object

Värdet som ska konverteras.

jsonTypeInfo
JsonTypeInfo

Metadata om vilken typ som ska konverteras.

Returer

Byte[]

En UTF-8-representation av värdet.

Undantag

jsonTypeInfo är null.

value matchar inte typen av jsonTypeInfo.

Gäller för

SerializeToUtf8Bytes(Object, Type, JsonSerializerOptions)

Källa:
JsonSerializer.Write.ByteArray.cs
Källa:
JsonSerializer.Write.ByteArray.cs
Källa:
JsonSerializer.Write.ByteArray.cs
Källa:
JsonSerializer.Write.ByteArray.cs
Källa:
JsonSerializer.Write.ByteArray.cs
Källa:
JsonSerializer.Write.ByteArray.cs
Källa:
JsonSerializer.Write.ByteArray.cs

Konverterar ett värde av den angivna typen till en JSON-sträng, kodad som UTF-8 byte.

[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()

Parametrar

value
Object

Värdet som ska konverteras.

inputType
Type

Typ av att value konvertera.

options
JsonSerializerOptions

Alternativ för att styra konverteringsbeteendet.

Returer

Byte[]

En JSON-strängrepresentation av värdet, kodat som UTF-8 byte.

Attribut

Undantag

inputType är inte kompatibelt med value.

inputType är null.

Det finns inga kompatibla JsonConverter för inputType eller dess serialiserbara medlemmar.

Kommentarer

Mer information finns i Serialisera och deserialisera JSON.

Gäller för

SerializeToUtf8Bytes(Object, Type, JsonSerializerContext)

Källa:
JsonSerializer.Write.ByteArray.cs
Källa:
JsonSerializer.Write.ByteArray.cs
Källa:
JsonSerializer.Write.ByteArray.cs
Källa:
JsonSerializer.Write.ByteArray.cs
Källa:
JsonSerializer.Write.ByteArray.cs
Källa:
JsonSerializer.Write.ByteArray.cs
Källa:
JsonSerializer.Write.ByteArray.cs

Konverterar det angivna värdet till en Byte matris.

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()

Parametrar

value
Object

Värdet som ska konverteras.

inputType
Type

Typ av att value konvertera.

context
JsonSerializerContext

En metadataprovider för serialiserbara typer.

Returer

Byte[]

En UTF-8-representation av värdet.

Undantag

inputType är inte kompatibelt med value.

inputType är null.

Det finns inga kompatibla JsonConverter för inputType eller dess serialiserbara medlemmar.

Metoden GetTypeInfo(Type) för de angivna context returnerar null för den typ som ska konverteras.

Gäller för

SerializeToUtf8Bytes<TValue>(TValue, JsonSerializerOptions)

Källa:
JsonSerializer.Write.ByteArray.cs
Källa:
JsonSerializer.Write.ByteArray.cs
Källa:
JsonSerializer.Write.ByteArray.cs
Källa:
JsonSerializer.Write.ByteArray.cs
Källa:
JsonSerializer.Write.ByteArray.cs
Källa:
JsonSerializer.Write.ByteArray.cs
Källa:
JsonSerializer.Write.ByteArray.cs

Konverterar värdet för en typ som anges av en allmän typparameter till en JSON-sträng, kodad som UTF-8 byte.

[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()

Typparametrar

TValue

Typ av värde.

Parametrar

value
TValue

Värdet som ska konverteras.

options
JsonSerializerOptions

Alternativ för att styra konverteringsbeteendet.

Returer

Byte[]

En JSON-strängrepresentation av värdet, kodat som UTF-8 byte.

Attribut

Undantag

Det finns inga kompatibla JsonConverter för TValue eller dess serialiserbara medlemmar.

Kommentarer

Mer information finns i Serialisera och deserialisera JSON.

Gäller för

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

Källa:
JsonSerializer.Write.ByteArray.cs
Källa:
JsonSerializer.Write.ByteArray.cs
Källa:
JsonSerializer.Write.ByteArray.cs
Källa:
JsonSerializer.Write.ByteArray.cs
Källa:
JsonSerializer.Write.ByteArray.cs
Källa:
JsonSerializer.Write.ByteArray.cs
Källa:
JsonSerializer.Write.ByteArray.cs

Konverterar det angivna värdet till en Byte matris.

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()

Typparametrar

TValue

Typ av värde som ska serialiseras.

Parametrar

value
TValue

Värdet som ska konverteras.

jsonTypeInfo
JsonTypeInfo<TValue>

Metadata om vilken typ som ska konverteras.

Returer

Byte[]

En UTF-8-representation av värdet.

Undantag

Det finns inga kompatibla JsonConverter för TValue eller dess serialiserbara medlemmar.

jsonTypeInfo är null.

Gäller för