HttpContentJsonExtensions.ReadFromJsonAsync Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Surcharges
| Nom | Description |
|---|---|
| ReadFromJsonAsync(HttpContent, Type, CancellationToken) |
Lit le contenu HTTP et retourne la valeur qui résulte de la désérialisation du contenu au format JSON dans une opération asynchrone. |
| ReadFromJsonAsync(HttpContent, Type, JsonSerializerOptions, CancellationToken) |
Lit le contenu HTTP et retourne la valeur qui résulte de la désérialisation du contenu au format JSON dans une opération asynchrone. |
| ReadFromJsonAsync(HttpContent, Type, JsonSerializerContext, CancellationToken) |
Lit le contenu HTTP et retourne la valeur qui résulte de la désérialisation du contenu au format JSON dans une opération asynchrone. |
| ReadFromJsonAsync<T>(HttpContent, CancellationToken) |
Lit le contenu HTTP et retourne la valeur qui résulte de la désérialisation du contenu au format JSON dans une opération asynchrone. |
| ReadFromJsonAsync<T>(HttpContent, JsonSerializerOptions, CancellationToken) |
Lit le contenu HTTP et retourne la valeur qui résulte de la désérialisation du contenu au format JSON dans une opération asynchrone. |
| ReadFromJsonAsync<T>(HttpContent, JsonTypeInfo<T>, CancellationToken) |
Lit le contenu HTTP et retourne la valeur qui résulte de la désérialisation du contenu au format JSON dans une opération asynchrone. |
ReadFromJsonAsync(HttpContent, Type, CancellationToken)
- Source:
- HttpContentJsonExtensions.cs
- Source:
- HttpContentJsonExtensions.cs
- Source:
- HttpContentJsonExtensions.cs
- Source:
- HttpContentJsonExtensions.cs
- Source:
- HttpContentJsonExtensions.cs
- Source:
- HttpContentJsonExtensions.cs
Lit le contenu HTTP et retourne la valeur qui résulte de la désérialisation du contenu au format JSON dans une opération asynchrone.
[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)
Paramètres
- content
- HttpContent
Contenu à lire.
- type
- Type
Type de l’objet à désérialiser et retourner.
- cancellationToken
- CancellationToken
Jeton d’annulation qui peut être utilisé par d’autres objets ou threads pour recevoir une notification d’annulation.
Retours
Objet de tâche représentant l’opération asynchrone.
- Attributs
Exceptions
Le jeton d’annulation a été annulé. Cette exception est stockée dans la tâche retournée.
S’applique à
ReadFromJsonAsync(HttpContent, Type, JsonSerializerOptions, CancellationToken)
- Source:
- HttpContentJsonExtensions.cs
- Source:
- HttpContentJsonExtensions.cs
- Source:
- HttpContentJsonExtensions.cs
- Source:
- HttpContentJsonExtensions.cs
- Source:
- HttpContentJsonExtensions.cs
- Source:
- HttpContentJsonExtensions.cs
- Source:
- HttpContentJsonExtensions.cs
Lit le contenu HTTP et retourne la valeur qui résulte de la désérialisation du contenu au format JSON dans une opération asynchrone.
[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)
Paramètres
- content
- HttpContent
Contenu à lire.
- type
- Type
Type de l’objet à désérialiser et retourner.
- options
- JsonSerializerOptions
Options permettant de contrôler le comportement pendant la désérialisation. Les options par défaut sont celles spécifiées par Web.
- cancellationToken
- CancellationToken
Jeton d’annulation qui peut être utilisé par d’autres objets ou threads pour recevoir une notification d’annulation.
Retours
Objet de tâche représentant l’opération asynchrone.
- Attributs
Exceptions
Le jeton d’annulation a été annulé. Cette exception est stockée dans la tâche retournée.
S’applique à
ReadFromJsonAsync(HttpContent, Type, JsonSerializerContext, CancellationToken)
- Source:
- HttpContentJsonExtensions.cs
- Source:
- HttpContentJsonExtensions.cs
- Source:
- HttpContentJsonExtensions.cs
- Source:
- HttpContentJsonExtensions.cs
- Source:
- HttpContentJsonExtensions.cs
- Source:
- HttpContentJsonExtensions.cs
- Source:
- HttpContentJsonExtensions.cs
Lit le contenu HTTP et retourne la valeur qui résulte de la désérialisation du contenu au format JSON dans une opération asynchrone.
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)
Paramètres
- content
- HttpContent
Contenu à lire.
- type
- Type
Type de l’objet à désérialiser et retourner.
- context
- JsonSerializerContext
JsonSerializerContext utilisé pour contrôler le comportement de désérialisation.
- cancellationToken
- CancellationToken
Jeton d’annulation qui peut être utilisé par d’autres objets ou threads pour recevoir une notification d’annulation.
Retours
Objet de tâche représentant l’opération asynchrone.
Exceptions
Le jeton d’annulation a été annulé. Cette exception est stockée dans la tâche retournée.
S’applique à
ReadFromJsonAsync<T>(HttpContent, CancellationToken)
- Source:
- HttpContentJsonExtensions.cs
- Source:
- HttpContentJsonExtensions.cs
- Source:
- HttpContentJsonExtensions.cs
- Source:
- HttpContentJsonExtensions.cs
- Source:
- HttpContentJsonExtensions.cs
- Source:
- HttpContentJsonExtensions.cs
Lit le contenu HTTP et retourne la valeur qui résulte de la désérialisation du contenu au format JSON dans une opération asynchrone.
[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)
Paramètres de type
- T
Type cible vers lequel désérialiser.
Paramètres
- content
- HttpContent
Contenu à lire.
- cancellationToken
- CancellationToken
Jeton d’annulation qui peut être utilisé par d’autres objets ou threads pour recevoir une notification d’annulation.
Retours
Objet de tâche représentant l’opération asynchrone.
- Attributs
Exceptions
Le jeton d’annulation a été annulé. Cette exception est stockée dans la tâche retournée.
S’applique à
ReadFromJsonAsync<T>(HttpContent, JsonSerializerOptions, CancellationToken)
- Source:
- HttpContentJsonExtensions.cs
- Source:
- HttpContentJsonExtensions.cs
- Source:
- HttpContentJsonExtensions.cs
- Source:
- HttpContentJsonExtensions.cs
- Source:
- HttpContentJsonExtensions.cs
- Source:
- HttpContentJsonExtensions.cs
- Source:
- HttpContentJsonExtensions.cs
Lit le contenu HTTP et retourne la valeur qui résulte de la désérialisation du contenu au format JSON dans une opération asynchrone.
[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)
Paramètres de type
- T
Type cible vers lequel désérialiser.
Paramètres
- content
- HttpContent
Contenu à lire.
- options
- JsonSerializerOptions
Options permettant de contrôler le comportement pendant la désérialisation. Les options par défaut sont celles spécifiées par Web.
- cancellationToken
- CancellationToken
Jeton d’annulation qui peut être utilisé par d’autres objets ou threads pour recevoir une notification d’annulation.
Retours
Objet de tâche représentant l’opération asynchrone.
- Attributs
Exceptions
Le jeton d’annulation a été annulé. Cette exception est stockée dans la tâche retournée.
S’applique à
ReadFromJsonAsync<T>(HttpContent, JsonTypeInfo<T>, CancellationToken)
- Source:
- HttpContentJsonExtensions.cs
- Source:
- HttpContentJsonExtensions.cs
- Source:
- HttpContentJsonExtensions.cs
- Source:
- HttpContentJsonExtensions.cs
- Source:
- HttpContentJsonExtensions.cs
- Source:
- HttpContentJsonExtensions.cs
- Source:
- HttpContentJsonExtensions.cs
Lit le contenu HTTP et retourne la valeur qui résulte de la désérialisation du contenu au format JSON dans une opération asynchrone.
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)
Paramètres de type
- T
Type cible vers lequel désérialiser.
Paramètres
- content
- HttpContent
Contenu à lire.
- jsonTypeInfo
- JsonTypeInfo<T>
JsonTypeInfo utilisé pour contrôler le comportement de désérialisation.
- cancellationToken
- CancellationToken
Jeton d’annulation qui peut être utilisé par d’autres objets ou threads pour recevoir une notification d’annulation.
Retours
Objet de tâche représentant l’opération asynchrone.
Exceptions
Le jeton d’annulation a été annulé. Cette exception est stockée dans la tâche retournée.