HttpContentJsonExtensions.ReadFromJsonAsAsyncEnumerable 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
| 名称 | 说明 |
|---|---|
| ReadFromJsonAsAsyncEnumerable<TValue>(HttpContent, CancellationToken) |
读取 HTTP 内容并返回在异步可枚举操作中将内容反序列化为 JSON 的结果的值。 |
| ReadFromJsonAsAsyncEnumerable<TValue>(HttpContent, JsonSerializerOptions, CancellationToken) |
读取 HTTP 内容并返回在异步可枚举操作中将内容反序列化为 JSON 的结果的值。 |
| ReadFromJsonAsAsyncEnumerable<TValue>(HttpContent, JsonTypeInfo<TValue>, CancellationToken) |
读取 HTTP 内容并返回在异步可枚举操作中将内容反序列化为 JSON 的结果的值。 |
ReadFromJsonAsAsyncEnumerable<TValue>(HttpContent, CancellationToken)
读取 HTTP 内容并返回在异步可枚举操作中将内容反序列化为 JSON 的结果的值。
[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.Collections.Generic.IAsyncEnumerable<TValue?> ReadFromJsonAsAsyncEnumerable<TValue>(this System.Net.Http.HttpContent content, System.Threading.CancellationToken cancellationToken = default);
public static System.Collections.Generic.IAsyncEnumerable<TValue?> ReadFromJsonAsAsyncEnumerable<TValue>(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 ReadFromJsonAsAsyncEnumerable : System.Net.Http.HttpContent * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<'Value>
static member ReadFromJsonAsAsyncEnumerable : System.Net.Http.HttpContent * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<'Value>
<Extension()>
Public Function ReadFromJsonAsAsyncEnumerable(Of TValue) (content As HttpContent, Optional cancellationToken As CancellationToken = Nothing) As IAsyncEnumerable(Of TValue)
类型参数
- TValue
要反序列化的目标类型。
参数
- content
- HttpContent
- cancellationToken
- CancellationToken
返回
表示反序列化响应正文的一个 IAsyncEnumerable<T> 。
- 属性
例外
content 是 null。
取消令牌已取消。 此异常存储在返回的任务中。
适用于
ReadFromJsonAsAsyncEnumerable<TValue>(HttpContent, JsonSerializerOptions, CancellationToken)
读取 HTTP 内容并返回在异步可枚举操作中将内容反序列化为 JSON 的结果的值。
[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.Collections.Generic.IAsyncEnumerable<TValue?> ReadFromJsonAsAsyncEnumerable<TValue>(this System.Net.Http.HttpContent content, System.Text.Json.JsonSerializerOptions? options, System.Threading.CancellationToken cancellationToken = default);
public static System.Collections.Generic.IAsyncEnumerable<TValue?> ReadFromJsonAsAsyncEnumerable<TValue>(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 ReadFromJsonAsAsyncEnumerable : System.Net.Http.HttpContent * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<'Value>
static member ReadFromJsonAsAsyncEnumerable : System.Net.Http.HttpContent * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<'Value>
<Extension()>
Public Function ReadFromJsonAsAsyncEnumerable(Of TValue) (content As HttpContent, options As JsonSerializerOptions, Optional cancellationToken As CancellationToken = Nothing) As IAsyncEnumerable(Of TValue)
类型参数
- TValue
要反序列化的目标类型。
参数
- content
- HttpContent
要从中读取的内容。
- options
- JsonSerializerOptions
用于在反序列化期间控制行为的选项。 默认选项由 Web.
- cancellationToken
- CancellationToken
返回
表示反序列化响应正文的一个 IAsyncEnumerable<T> 。
- 属性
例外
content 是 null。
取消令牌已取消。 此异常存储在返回的任务中。
适用于
ReadFromJsonAsAsyncEnumerable<TValue>(HttpContent, JsonTypeInfo<TValue>, CancellationToken)
读取 HTTP 内容并返回在异步可枚举操作中将内容反序列化为 JSON 的结果的值。
public static System.Collections.Generic.IAsyncEnumerable<TValue?> ReadFromJsonAsAsyncEnumerable<TValue>(this System.Net.Http.HttpContent content, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo, System.Threading.CancellationToken cancellationToken = default);
static member ReadFromJsonAsAsyncEnumerable : System.Net.Http.HttpContent * System.Text.Json.Serialization.Metadata.JsonTypeInfo<'Value> * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<'Value>
<Extension()>
Public Function ReadFromJsonAsAsyncEnumerable(Of TValue) (content As HttpContent, jsonTypeInfo As JsonTypeInfo(Of TValue), Optional cancellationToken As CancellationToken = Nothing) As IAsyncEnumerable(Of TValue)
类型参数
- TValue
要反序列化的目标类型。
参数
- content
- HttpContent
要从中读取的内容。
- jsonTypeInfo
- JsonTypeInfo<TValue>
用于控制反序列化行为的 JsonTypeInfo。
- cancellationToken
- CancellationToken
返回
表示反序列化响应正文的一个 IAsyncEnumerable<T> 。
例外
content 是 null。
取消令牌已取消。 此异常存储在返回的任务中。