JsonSerializer.SerializeAsync Methode
Definitie
Belangrijk
Bepaalde informatie heeft betrekking op een voorlopige productversie die aanzienlijk kan worden gewijzigd voordat deze wordt uitgebracht. Microsoft biedt geen enkele expliciete of impliciete garanties met betrekking tot de informatie die hier wordt verstrekt.
Overloads
| Name | Description |
|---|---|
| SerializeAsync(Stream, Object, Type, JsonSerializerOptions, CancellationToken) |
Converteert asynchroon de waarde van een opgegeven type naar JSON-gecodeerde JSON-tekst met UTF-8 en schrijft deze naar de opgegeven stroom. |
| SerializeAsync(PipeWriter, Object, Type, JsonSerializerContext, CancellationToken) |
Converteert de opgegeven waarde naar met UTF-8 gecodeerde JSON-tekst en schrijft deze naar de PipeWriter. |
| SerializeAsync(Stream, Object, Type, JsonSerializerContext, CancellationToken) |
Converteert de opgegeven waarde naar met UTF-8 gecodeerde JSON-tekst en schrijft deze naar de Stream. |
| SerializeAsync(Stream, Object, JsonTypeInfo, CancellationToken) |
Converteert de opgegeven waarde naar met UTF-8 gecodeerde JSON-tekst en schrijft deze naar de Stream. |
| SerializeAsync(PipeWriter, Object, JsonTypeInfo, CancellationToken) |
Converteert de opgegeven waarde naar met UTF-8 gecodeerde JSON-tekst en schrijft deze naar de PipeWriter. |
| SerializeAsync(PipeWriter, Object, Type, JsonSerializerOptions, CancellationToken) |
Converteert de opgegeven waarde naar met UTF-8 gecodeerde JSON-tekst en schrijft deze naar de PipeWriter. |
| SerializeAsync<TValue>(PipeWriter, TValue, JsonSerializerOptions, CancellationToken) |
Converteert de opgegeven waarde naar met UTF-8 gecodeerde JSON-tekst en schrijft deze naar de PipeWriter. |
| SerializeAsync<TValue>(PipeWriter, TValue, JsonTypeInfo<TValue>, CancellationToken) |
Converteert de opgegeven waarde naar met UTF-8 gecodeerde JSON-tekst en schrijft deze naar de PipeWriter. |
| SerializeAsync<TValue>(Stream, TValue, JsonSerializerOptions, CancellationToken) |
Asynchroon converteert een waarde van een type dat is opgegeven door een algemene typeparameter naar UTF-8 gecodeerde JSON-tekst en schrijft deze naar een stream. |
| SerializeAsync<TValue>(Stream, TValue, JsonTypeInfo<TValue>, CancellationToken) |
Converteert de opgegeven waarde naar met UTF-8 gecodeerde JSON-tekst en schrijft deze naar de Stream. |
SerializeAsync(Stream, Object, Type, JsonSerializerOptions, CancellationToken)
Converteert asynchroon de waarde van een opgegeven type naar JSON-gecodeerde JSON-tekst met UTF-8 en schrijft deze naar de opgegeven stroom.
[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 System.Threading.Tasks.Task SerializeAsync(System.IO.Stream utf8Json, object? value, Type inputType, System.Text.Json.JsonSerializerOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
public static System.Threading.Tasks.Task SerializeAsync(System.IO.Stream utf8Json, object? value, Type inputType, System.Text.Json.JsonSerializerOptions? options = default, System.Threading.CancellationToken cancellationToken = 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 System.Threading.Tasks.Task SerializeAsync(System.IO.Stream utf8Json, object? value, Type inputType, System.Text.Json.JsonSerializerOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
public static System.Threading.Tasks.Task SerializeAsync(System.IO.Stream utf8Json, object value, Type inputType, System.Text.Json.JsonSerializerOptions options = default, System.Threading.CancellationToken cancellationToken = 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 SerializeAsync : System.IO.Stream * obj * Type * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task
static member SerializeAsync : System.IO.Stream * obj * Type * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task
[<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 SerializeAsync : System.IO.Stream * obj * Type * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function SerializeAsync (utf8Json As Stream, value As Object, inputType As Type, Optional options As JsonSerializerOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task
Public Shared Function SerializeAsync (utf8Json As Stream, value As Object, inputType As Type, Optional options As JsonSerializerOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task
Parameters
- utf8Json
- Stream
De UTF-8-stream naar schrijven.
- value
- Object
De waarde die moet worden geconverteerd.
- inputType
- Type
Het type dat value u wilt converteren.
- options
- JsonSerializerOptions
Opties voor het beheren van serialisatiegedrag.
- cancellationToken
- CancellationToken
Een token dat kan worden gebruikt om de schrijfbewerking te annuleren.
Retouren
Een taak die de asynchrone schrijfbewerking vertegenwoordigt.
- Kenmerken
Uitzonderingen
inputType is niet compatibel met value.
utf8Json of inputType is null.
Er is geen compatibel JsonConverter voor inputType of de serialiseerbare leden.
Het annuleringstoken is geannuleerd. Deze uitzondering wordt opgeslagen in de geretourneerde taak.
Opmerkingen
Zie JSON serialiseren en deserialiseren voor meer informatie.
Deze methode slaat op in de taak die alle uitzonderingen voor niet-gebruik retourneert die de synchrone tegenhanger van de methode kan genereren. Als er een uitzondering wordt opgeslagen in de geretourneerde taak, wordt deze uitzondering gegenereerd wanneer de taak wordt gewacht. Gebruiksonderzondering, zoals ArgumentException, worden nog steeds synchroon gegenereerd. Zie de uitzonderingen die zijn gegenereerd door Serialize(Stream, Object, Type, JsonSerializerOptions)de opgeslagen uitzonderingen voor de opgeslagen uitzonderingen.
Van toepassing op
SerializeAsync(PipeWriter, Object, Type, JsonSerializerContext, CancellationToken)
Converteert de opgegeven waarde naar met UTF-8 gecodeerde JSON-tekst en schrijft deze naar de PipeWriter.
public static System.Threading.Tasks.Task SerializeAsync(System.IO.Pipelines.PipeWriter utf8Json, object? value, Type inputType, System.Text.Json.Serialization.JsonSerializerContext context, System.Threading.CancellationToken cancellationToken = default);
static member SerializeAsync : System.IO.Pipelines.PipeWriter * obj * Type * System.Text.Json.Serialization.JsonSerializerContext * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function SerializeAsync (utf8Json As PipeWriter, value As Object, inputType As Type, context As JsonSerializerContext, Optional cancellationToken As CancellationToken = Nothing) As Task
Parameters
- utf8Json
- PipeWriter
De UTF-8 PipeWriter naar schrijven.
- value
- Object
De waarde die moet worden geconverteerd.
- inputType
- Type
Het type dat value u wilt converteren.
- context
- JsonSerializerContext
Een metagegevensprovider voor serialiseerbare typen.
- cancellationToken
- CancellationToken
De CancellationToken bewerking die kan worden gebruikt om de schrijfbewerking te annuleren.
Retouren
Een taak die de asynchrone schrijfbewerking vertegenwoordigt.
Uitzonderingen
inputType is niet compatibel met value.
utf8Json, inputTypeof context is null.
Er is geen compatibel JsonConverter voor inputType of de serialiseerbare leden.
Van toepassing op
SerializeAsync(Stream, Object, Type, JsonSerializerContext, CancellationToken)
Converteert de opgegeven waarde naar met UTF-8 gecodeerde JSON-tekst en schrijft deze naar de Stream.
public static System.Threading.Tasks.Task SerializeAsync(System.IO.Stream utf8Json, object? value, Type inputType, System.Text.Json.Serialization.JsonSerializerContext context, System.Threading.CancellationToken cancellationToken = default);
static member SerializeAsync : System.IO.Stream * obj * Type * System.Text.Json.Serialization.JsonSerializerContext * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function SerializeAsync (utf8Json As Stream, value As Object, inputType As Type, context As JsonSerializerContext, Optional cancellationToken As CancellationToken = Nothing) As Task
Parameters
- value
- Object
De waarde die moet worden geconverteerd.
- inputType
- Type
Het type dat value u wilt converteren.
- context
- JsonSerializerContext
Een metagegevensprovider voor serialiseerbare typen.
- cancellationToken
- CancellationToken
De CancellationToken bewerking die kan worden gebruikt om de schrijfbewerking te annuleren.
Retouren
Een taak die de asynchrone schrijfbewerking vertegenwoordigt.
Uitzonderingen
inputType is niet compatibel met value.
utf8Json, inputTypeof context is null.
Er is geen compatibel JsonConverter voor inputType of de serialiseerbare leden.
Het annuleringstoken is geannuleerd. Deze uitzondering wordt opgeslagen in de geretourneerde taak.
Opmerkingen
Deze methode slaat op in de taak die alle uitzonderingen voor niet-gebruik retourneert die de synchrone tegenhanger van de methode kan genereren. Als er een uitzondering wordt opgeslagen in de geretourneerde taak, wordt deze uitzondering gegenereerd wanneer de taak wordt gewacht. Gebruiksonderzondering, zoals ArgumentException, worden nog steeds synchroon gegenereerd. Zie de uitzonderingen die zijn gegenereerd door Serialize(Stream, Object, Type, JsonSerializerContext)de opgeslagen uitzonderingen voor de opgeslagen uitzonderingen.
Van toepassing op
SerializeAsync(Stream, Object, JsonTypeInfo, CancellationToken)
Converteert de opgegeven waarde naar met UTF-8 gecodeerde JSON-tekst en schrijft deze naar de Stream.
public static System.Threading.Tasks.Task SerializeAsync(System.IO.Stream utf8Json, object? value, System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo, System.Threading.CancellationToken cancellationToken = default);
static member SerializeAsync : System.IO.Stream * obj * System.Text.Json.Serialization.Metadata.JsonTypeInfo * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function SerializeAsync (utf8Json As Stream, value As Object, jsonTypeInfo As JsonTypeInfo, Optional cancellationToken As CancellationToken = Nothing) As Task
Parameters
- value
- Object
De waarde die moet worden geconverteerd.
- jsonTypeInfo
- JsonTypeInfo
Metagegevens over het type dat moet worden geconverteerd.
- cancellationToken
- CancellationToken
De CancellationToken bewerking die kan worden gebruikt om de schrijfbewerking te annuleren.
Retouren
Een taak die de asynchrone schrijfbewerking vertegenwoordigt.
Uitzonderingen
utf8Json is null.
value komt niet overeen met het type jsonTypeInfo.
Het annuleringstoken is geannuleerd. Deze uitzondering wordt opgeslagen in de geretourneerde taak.
Van toepassing op
SerializeAsync(PipeWriter, Object, JsonTypeInfo, CancellationToken)
Converteert de opgegeven waarde naar met UTF-8 gecodeerde JSON-tekst en schrijft deze naar de PipeWriter.
public static System.Threading.Tasks.Task SerializeAsync(System.IO.Pipelines.PipeWriter utf8Json, object? value, System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo, System.Threading.CancellationToken cancellationToken = default);
static member SerializeAsync : System.IO.Pipelines.PipeWriter * obj * System.Text.Json.Serialization.Metadata.JsonTypeInfo * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function SerializeAsync (utf8Json As PipeWriter, value As Object, jsonTypeInfo As JsonTypeInfo, Optional cancellationToken As CancellationToken = Nothing) As Task
Parameters
- utf8Json
- PipeWriter
De UTF-8 PipeWriter naar schrijven.
- value
- Object
De waarde die moet worden geconverteerd.
- jsonTypeInfo
- JsonTypeInfo
Metagegevens over het type dat moet worden geconverteerd.
- cancellationToken
- CancellationToken
De CancellationToken bewerking die kan worden gebruikt om de schrijfbewerking te annuleren.
Retouren
Een taak die de asynchrone schrijfbewerking vertegenwoordigt.
Uitzonderingen
utf8Json is null.
value komt niet overeen met het type jsonTypeInfo.
Van toepassing op
SerializeAsync(PipeWriter, Object, Type, JsonSerializerOptions, CancellationToken)
Converteert de opgegeven waarde naar met UTF-8 gecodeerde JSON-tekst en schrijft deze naar de PipeWriter.
[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 System.Threading.Tasks.Task SerializeAsync(System.IO.Pipelines.PipeWriter utf8Json, object? value, Type inputType, System.Text.Json.JsonSerializerOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
public static System.Threading.Tasks.Task SerializeAsync(System.IO.Pipelines.PipeWriter utf8Json, object? value, Type inputType, System.Text.Json.JsonSerializerOptions? options = default, System.Threading.CancellationToken cancellationToken = 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 SerializeAsync : System.IO.Pipelines.PipeWriter * obj * Type * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task
static member SerializeAsync : System.IO.Pipelines.PipeWriter * obj * Type * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function SerializeAsync (utf8Json As PipeWriter, value As Object, inputType As Type, Optional options As JsonSerializerOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task
Parameters
- utf8Json
- PipeWriter
De UTF-8 PipeWriter naar schrijven.
- value
- Object
De waarde die moet worden geconverteerd.
- inputType
- Type
Het type dat value u wilt converteren.
- options
- JsonSerializerOptions
Opties voor het beheren van het conversiegedrag.
- cancellationToken
- CancellationToken
De CancellationToken bewerking die kan worden gebruikt om de schrijfbewerking te annuleren.
Retouren
Een taak die de asynchrone schrijfbewerking vertegenwoordigt.
- Kenmerken
Uitzonderingen
inputType is niet compatibel met value.
utf8Json of inputType is null.
Er is geen compatibel JsonConverter voor inputType of de serialiseerbare leden.
Van toepassing op
SerializeAsync<TValue>(PipeWriter, TValue, JsonSerializerOptions, CancellationToken)
Converteert de opgegeven waarde naar met UTF-8 gecodeerde JSON-tekst en schrijft deze naar de PipeWriter.
[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 System.Threading.Tasks.Task SerializeAsync<TValue>(System.IO.Pipelines.PipeWriter utf8Json, TValue value, System.Text.Json.JsonSerializerOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
public static System.Threading.Tasks.Task SerializeAsync<TValue>(System.IO.Pipelines.PipeWriter utf8Json, TValue value, System.Text.Json.JsonSerializerOptions? options = default, System.Threading.CancellationToken cancellationToken = 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 SerializeAsync : System.IO.Pipelines.PipeWriter * 'Value * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task
static member SerializeAsync : System.IO.Pipelines.PipeWriter * 'Value * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function SerializeAsync(Of TValue) (utf8Json As PipeWriter, value As TValue, Optional options As JsonSerializerOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task
Type parameters
- TValue
Het type van de waarde dat moet worden geserialiseerd.
Parameters
- utf8Json
- PipeWriter
De UTF-8 PipeWriter naar schrijven.
- value
- TValue
De waarde die moet worden geconverteerd.
- options
- JsonSerializerOptions
Opties voor het beheren van het conversiegedrag.
- cancellationToken
- CancellationToken
De CancellationToken bewerking die kan worden gebruikt om de schrijfbewerking te annuleren.
Retouren
Een taak die de asynchrone schrijfbewerking vertegenwoordigt.
- Kenmerken
Uitzonderingen
utf8Json is null.
Er is geen compatibel JsonConverter voor TValue of de serialiseerbare leden.
Van toepassing op
SerializeAsync<TValue>(PipeWriter, TValue, JsonTypeInfo<TValue>, CancellationToken)
Converteert de opgegeven waarde naar met UTF-8 gecodeerde JSON-tekst en schrijft deze naar de PipeWriter.
public static System.Threading.Tasks.Task SerializeAsync<TValue>(System.IO.Pipelines.PipeWriter utf8Json, TValue value, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo, System.Threading.CancellationToken cancellationToken = default);
static member SerializeAsync : System.IO.Pipelines.PipeWriter * 'Value * System.Text.Json.Serialization.Metadata.JsonTypeInfo<'Value> * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function SerializeAsync(Of TValue) (utf8Json As PipeWriter, value As TValue, jsonTypeInfo As JsonTypeInfo(Of TValue), Optional cancellationToken As CancellationToken = Nothing) As Task
Type parameters
- TValue
Het type van de waarde dat moet worden geserialiseerd.
Parameters
- utf8Json
- PipeWriter
De UTF-8 PipeWriter naar schrijven.
- value
- TValue
De waarde die moet worden geconverteerd.
- jsonTypeInfo
- JsonTypeInfo<TValue>
Metagegevens over het type dat moet worden geconverteerd.
- cancellationToken
- CancellationToken
De CancellationToken bewerking die kan worden gebruikt om de schrijfbewerking te annuleren.
Retouren
Een taak die de asynchrone schrijfbewerking vertegenwoordigt.
Uitzonderingen
utf8Json is null.
Van toepassing op
SerializeAsync<TValue>(Stream, TValue, JsonSerializerOptions, CancellationToken)
Asynchroon converteert een waarde van een type dat is opgegeven door een algemene typeparameter naar UTF-8 gecodeerde JSON-tekst en schrijft deze naar een stream.
[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 System.Threading.Tasks.Task SerializeAsync<TValue>(System.IO.Stream utf8Json, TValue value, System.Text.Json.JsonSerializerOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
public static System.Threading.Tasks.Task SerializeAsync<TValue>(System.IO.Stream utf8Json, TValue value, System.Text.Json.JsonSerializerOptions? options = default, System.Threading.CancellationToken cancellationToken = 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 System.Threading.Tasks.Task SerializeAsync<TValue>(System.IO.Stream utf8Json, TValue value, System.Text.Json.JsonSerializerOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
public static System.Threading.Tasks.Task SerializeAsync<TValue>(System.IO.Stream utf8Json, TValue value, System.Text.Json.JsonSerializerOptions options = default, System.Threading.CancellationToken cancellationToken = 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 SerializeAsync : System.IO.Stream * 'Value * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task
static member SerializeAsync : System.IO.Stream * 'Value * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task
[<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 SerializeAsync : System.IO.Stream * 'Value * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function SerializeAsync(Of TValue) (utf8Json As Stream, value As TValue, Optional options As JsonSerializerOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task
Public Shared Function SerializeAsync(Of TValue) (utf8Json As Stream, value As TValue, Optional options As JsonSerializerOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task
Type parameters
- TValue
Het type van de waarde dat moet worden geserialiseerd.
Parameters
- utf8Json
- Stream
De UTF-8-stream naar schrijven.
- value
- TValue
De waarde die moet worden geconverteerd.
- options
- JsonSerializerOptions
Opties voor het beheren van serialisatiegedrag.
- cancellationToken
- CancellationToken
Een token dat kan worden gebruikt om de schrijfbewerking te annuleren.
Retouren
Een taak die de asynchrone schrijfbewerking vertegenwoordigt.
- Kenmerken
Uitzonderingen
utf8Json is null.
Er is geen compatibel JsonConverter voor TValue of de serialiseerbare leden.
Het annuleringstoken is geannuleerd. Deze uitzondering wordt opgeslagen in de geretourneerde taak.
Opmerkingen
Zie JSON serialiseren en deserialiseren voor meer informatie.
Van toepassing op
SerializeAsync<TValue>(Stream, TValue, JsonTypeInfo<TValue>, CancellationToken)
Converteert de opgegeven waarde naar met UTF-8 gecodeerde JSON-tekst en schrijft deze naar de Stream.
public static System.Threading.Tasks.Task SerializeAsync<TValue>(System.IO.Stream utf8Json, TValue value, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo, System.Threading.CancellationToken cancellationToken = default);
static member SerializeAsync : System.IO.Stream * 'Value * System.Text.Json.Serialization.Metadata.JsonTypeInfo<'Value> * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function SerializeAsync(Of TValue) (utf8Json As Stream, value As TValue, jsonTypeInfo As JsonTypeInfo(Of TValue), Optional cancellationToken As CancellationToken = Nothing) As Task
Type parameters
- TValue
Het type van de waarde dat moet worden geserialiseerd.
Parameters
- value
- TValue
De waarde die moet worden geconverteerd.
- jsonTypeInfo
- JsonTypeInfo<TValue>
Metagegevens over het type dat moet worden geconverteerd.
- cancellationToken
- CancellationToken
De CancellationToken bewerking die kan worden gebruikt om de schrijfbewerking te annuleren.
Retouren
Een taak die de asynchrone schrijfbewerking vertegenwoordigt.
Uitzonderingen
utf8Json is null.
Er is geen compatibel JsonConverter voor TValue of de serialiseerbare leden.
Het annuleringstoken is geannuleerd. Deze uitzondering wordt opgeslagen in de geretourneerde taak.