HttpContentJsonExtensions.ReadFromJsonAsync Metoda
Definice
Důležité
Některé informace platí pro předběžně vydaný produkt, který se může zásadně změnit, než ho výrobce nebo autor vydá. Microsoft neposkytuje žádné záruky, výslovné ani předpokládané, týkající se zde uváděných informací.
Přetížení
| Name | Description |
|---|---|
| ReadFromJsonAsync(HttpContent, Type, CancellationToken) |
Přečte obsah HTTP a vrátí hodnotu, která má za následek deserializaci obsahu jako JSON v asynchronní operaci. |
| ReadFromJsonAsync(HttpContent, Type, JsonSerializerOptions, CancellationToken) |
Přečte obsah HTTP a vrátí hodnotu, která má za následek deserializaci obsahu jako JSON v asynchronní operaci. |
| ReadFromJsonAsync(HttpContent, Type, JsonSerializerContext, CancellationToken) |
Přečte obsah HTTP a vrátí hodnotu, která má za následek deserializaci obsahu jako JSON v asynchronní operaci. |
| ReadFromJsonAsync<T>(HttpContent, CancellationToken) |
Přečte obsah HTTP a vrátí hodnotu, která má za následek deserializaci obsahu jako JSON v asynchronní operaci. |
| ReadFromJsonAsync<T>(HttpContent, JsonSerializerOptions, CancellationToken) |
Přečte obsah HTTP a vrátí hodnotu, která má za následek deserializaci obsahu jako JSON v asynchronní operaci. |
| ReadFromJsonAsync<T>(HttpContent, JsonTypeInfo<T>, CancellationToken) |
Přečte obsah HTTP a vrátí hodnotu, která má za následek deserializaci obsahu jako JSON v asynchronní operaci. |
ReadFromJsonAsync(HttpContent, Type, CancellationToken)
Přečte obsah HTTP a vrátí hodnotu, která má za následek deserializaci obsahu jako JSON v asynchronní operaci.
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext.")]
[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<object?> ReadFromJsonAsync(this System.Net.Http.HttpContent content, Type type, System.Threading.CancellationToken cancellationToken = default);
public static System.Threading.Tasks.Task<object?> ReadFromJsonAsync(this System.Net.Http.HttpContent content, Type type, System.Threading.CancellationToken cancellationToken = default);
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext.")>]
[<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 ReadFromJsonAsync : System.Net.Http.HttpContent * Type * System.Threading.CancellationToken -> System.Threading.Tasks.Task<obj>
static member ReadFromJsonAsync : System.Net.Http.HttpContent * Type * System.Threading.CancellationToken -> System.Threading.Tasks.Task<obj>
<Extension()>
Public Function ReadFromJsonAsync (content As HttpContent, type As Type, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Object)
Parametry
- content
- HttpContent
Obsah, ze který se má číst.
- type
- Type
Typ objektu k deserializaci a vrácení.
- cancellationToken
- CancellationToken
Token zrušení, který lze použít jinými objekty nebo vlákny k přijetí oznámení o zrušení.
Návraty
Objekt úkolu představující asynchronní operaci.
- Atributy
Výjimky
Token zrušení byl zrušen. Tato výjimka je uložena do vrácené úlohy.
Platí pro
ReadFromJsonAsync(HttpContent, Type, JsonSerializerOptions, CancellationToken)
Přečte obsah HTTP a vrátí hodnotu, která má za následek deserializaci obsahu jako JSON v asynchronní operaci.
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext.")]
[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<object?> ReadFromJsonAsync(this System.Net.Http.HttpContent content, Type type, System.Text.Json.JsonSerializerOptions? options, System.Threading.CancellationToken cancellationToken = default);
public static System.Threading.Tasks.Task<object?> ReadFromJsonAsync(this System.Net.Http.HttpContent content, Type type, 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<object?> ReadFromJsonAsync(this System.Net.Http.HttpContent content, Type type, 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. Use the overload that takes a JsonTypeInfo or JsonSerializerContext.")]
[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<object?> ReadFromJsonAsync(this System.Net.Http.HttpContent content, Type type, System.Text.Json.JsonSerializerOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
public static System.Threading.Tasks.Task<object?> ReadFromJsonAsync(this System.Net.Http.HttpContent content, Type type, System.Text.Json.JsonSerializerOptions? options, System.Threading.CancellationToken cancellationToken = default);
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext.")>]
[<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 ReadFromJsonAsync : System.Net.Http.HttpContent * Type * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<obj>
static member ReadFromJsonAsync : System.Net.Http.HttpContent * Type * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<obj>
[<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 ReadFromJsonAsync : System.Net.Http.HttpContent * Type * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<obj>
<Extension()>
Public Function ReadFromJsonAsync (content As HttpContent, type As Type, options As JsonSerializerOptions, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Object)
<Extension()>
Public Function ReadFromJsonAsync (content As HttpContent, type As Type, Optional options As JsonSerializerOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Object)
Parametry
- content
- HttpContent
Obsah, ze který se má číst.
- type
- Type
Typ objektu k deserializaci a vrácení.
- options
- JsonSerializerOptions
Možnosti řízení chování při deserializaci Výchozí možnosti jsou určené parametrem Web.
- cancellationToken
- CancellationToken
Token zrušení, který lze použít jinými objekty nebo vlákny k přijetí oznámení o zrušení.
Návraty
Objekt úkolu představující asynchronní operaci.
- Atributy
Výjimky
Token zrušení byl zrušen. Tato výjimka je uložena do vrácené úlohy.
Platí pro
ReadFromJsonAsync(HttpContent, Type, JsonSerializerContext, CancellationToken)
Přečte obsah HTTP a vrátí hodnotu, která má za následek deserializaci obsahu jako JSON v asynchronní operaci.
public static System.Threading.Tasks.Task<object?> ReadFromJsonAsync(this System.Net.Http.HttpContent content, Type type, System.Text.Json.Serialization.JsonSerializerContext context, System.Threading.CancellationToken cancellationToken = default);
static member ReadFromJsonAsync : System.Net.Http.HttpContent * Type * System.Text.Json.Serialization.JsonSerializerContext * System.Threading.CancellationToken -> System.Threading.Tasks.Task<obj>
<Extension()>
Public Function ReadFromJsonAsync (content As HttpContent, type As Type, context As JsonSerializerContext, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Object)
Parametry
- content
- HttpContent
Obsah, ze který se má číst.
- type
- Type
Typ objektu k deserializaci a vrácení.
- context
- JsonSerializerContext
JsonSerializerContext sloužící k řízení chování deserializace.
- cancellationToken
- CancellationToken
Token zrušení, který lze použít jinými objekty nebo vlákny k přijetí oznámení o zrušení.
Návraty
Objekt úkolu představující asynchronní operaci.
Výjimky
Token zrušení byl zrušen. Tato výjimka je uložena do vrácené úlohy.
Platí pro
ReadFromJsonAsync<T>(HttpContent, CancellationToken)
Přečte obsah HTTP a vrátí hodnotu, která má za následek deserializaci obsahu jako JSON v asynchronní operaci.
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext.")]
[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<T?> ReadFromJsonAsync<T>(this System.Net.Http.HttpContent content, System.Threading.CancellationToken cancellationToken = default);
public static System.Threading.Tasks.Task<T?> ReadFromJsonAsync<T>(this System.Net.Http.HttpContent content, System.Threading.CancellationToken cancellationToken = default);
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext.")>]
[<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 ReadFromJsonAsync : System.Net.Http.HttpContent * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'T>
static member ReadFromJsonAsync : System.Net.Http.HttpContent * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'T>
<Extension()>
Public Function ReadFromJsonAsync(Of T) (content As HttpContent, Optional cancellationToken As CancellationToken = Nothing) As Task(Of T)
Parametry typu
- T
Cílový typ, na který se má deserializovat.
Parametry
- content
- HttpContent
Obsah, ze který se má číst.
- cancellationToken
- CancellationToken
Token zrušení, který lze použít jinými objekty nebo vlákny k přijetí oznámení o zrušení.
Návraty
Objekt úkolu představující asynchronní operaci.
- Atributy
Výjimky
Token zrušení byl zrušen. Tato výjimka je uložena do vrácené úlohy.
Platí pro
ReadFromJsonAsync<T>(HttpContent, JsonSerializerOptions, CancellationToken)
Přečte obsah HTTP a vrátí hodnotu, která má za následek deserializaci obsahu jako JSON v asynchronní operaci.
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext.")]
[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<T?> ReadFromJsonAsync<T>(this System.Net.Http.HttpContent content, System.Text.Json.JsonSerializerOptions? options, System.Threading.CancellationToken cancellationToken = default);
public static System.Threading.Tasks.Task<T?> ReadFromJsonAsync<T>(this System.Net.Http.HttpContent content, 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<T?> ReadFromJsonAsync<T>(this System.Net.Http.HttpContent content, 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. Use the overload that takes a JsonTypeInfo or JsonSerializerContext.")]
[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<T?> ReadFromJsonAsync<T>(this System.Net.Http.HttpContent content, System.Text.Json.JsonSerializerOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
public static System.Threading.Tasks.Task<T?> ReadFromJsonAsync<T>(this System.Net.Http.HttpContent content, System.Text.Json.JsonSerializerOptions? options, System.Threading.CancellationToken cancellationToken = default);
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext.")>]
[<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 ReadFromJsonAsync : System.Net.Http.HttpContent * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'T>
static member ReadFromJsonAsync : System.Net.Http.HttpContent * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'T>
[<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 ReadFromJsonAsync : System.Net.Http.HttpContent * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'T>
<Extension()>
Public Function ReadFromJsonAsync(Of T) (content As HttpContent, options As JsonSerializerOptions, Optional cancellationToken As CancellationToken = Nothing) As Task(Of T)
<Extension()>
Public Function ReadFromJsonAsync(Of T) (content As HttpContent, Optional options As JsonSerializerOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of T)
Parametry typu
- T
Cílový typ, na který se má deserializovat.
Parametry
- content
- HttpContent
Obsah, ze který se má číst.
- options
- JsonSerializerOptions
Možnosti řízení chování při deserializaci Výchozí možnosti jsou určené parametrem Web.
- cancellationToken
- CancellationToken
Token zrušení, který lze použít jinými objekty nebo vlákny k přijetí oznámení o zrušení.
Návraty
Objekt úkolu představující asynchronní operaci.
- Atributy
Výjimky
Token zrušení byl zrušen. Tato výjimka je uložena do vrácené úlohy.
Platí pro
ReadFromJsonAsync<T>(HttpContent, JsonTypeInfo<T>, CancellationToken)
Přečte obsah HTTP a vrátí hodnotu, která má za následek deserializaci obsahu jako JSON v asynchronní operaci.
public static System.Threading.Tasks.Task<T?> ReadFromJsonAsync<T>(this System.Net.Http.HttpContent content, System.Text.Json.Serialization.Metadata.JsonTypeInfo<T> jsonTypeInfo, System.Threading.CancellationToken cancellationToken = default);
static member ReadFromJsonAsync : System.Net.Http.HttpContent * System.Text.Json.Serialization.Metadata.JsonTypeInfo<'T> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'T>
<Extension()>
Public Function ReadFromJsonAsync(Of T) (content As HttpContent, jsonTypeInfo As JsonTypeInfo(Of T), Optional cancellationToken As CancellationToken = Nothing) As Task(Of T)
Parametry typu
- T
Cílový typ, na který se má deserializovat.
Parametry
- content
- HttpContent
Obsah, ze který se má číst.
- jsonTypeInfo
- JsonTypeInfo<T>
JsonTypeInfo sloužící k řízení chování deserializace.
- cancellationToken
- CancellationToken
Token zrušení, který lze použít jinými objekty nebo vlákny k přijetí oznámení o zrušení.
Návraty
Objekt úkolu představující asynchronní operaci.
Výjimky
Token zrušení byl zrušen. Tato výjimka je uložena do vrácené úlohy.