HttpContentJsonExtensions.ReadFromJsonAsAsyncEnumerable Method

Definition

Overloads

ReadFromJsonAsAsyncEnumerable<TValue>(HttpContent, CancellationToken)

Reads the HTTP content and returns the value that results from deserializing the content as JSON in an async enumerable operation.

ReadFromJsonAsAsyncEnumerable<TValue>(HttpContent, JsonSerializerOptions, CancellationToken)

Reads the HTTP content and returns the value that results from deserializing the content as JSON in an async enumerable operation.

ReadFromJsonAsAsyncEnumerable<TValue>(HttpContent, JsonTypeInfo<TValue>, CancellationToken)

Reads the HTTP content and returns the value that results from deserializing the content as JSON in an async enumerable operation.

ReadFromJsonAsAsyncEnumerable<TValue>(HttpContent, CancellationToken)

Source:
HttpContentJsonExtensions.AsyncEnumerable.cs
Source:
HttpContentJsonExtensions.AsyncEnumerable.cs
Source:
HttpContentJsonExtensions.AsyncEnumerable.cs
Source:
HttpContentJsonExtensions.AsyncEnumerable.cs

Reads the HTTP content and returns the value that results from deserializing the content as JSON in an async enumerable operation.

C#
public static System.Collections.Generic.IAsyncEnumerable<TValue?> ReadFromJsonAsAsyncEnumerable<TValue>(this System.Net.Http.HttpContent content, System.Threading.CancellationToken cancellationToken = default);

Type Parameters

TValue

The target type to deserialize to.

Parameters

content
HttpContent
cancellationToken
CancellationToken

Returns

An IAsyncEnumerable<T> that represents the deserialized response body.

Exceptions

The content is null.

The cancellation token was canceled. This exception is stored into the returned task.

Applies to

.NET 9 and other versions
Product Versions
.NET 8 (package-provided), 8, 9 (package-provided), 9
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided)

ReadFromJsonAsAsyncEnumerable<TValue>(HttpContent, JsonSerializerOptions, CancellationToken)

Source:
HttpContentJsonExtensions.AsyncEnumerable.cs
Source:
HttpContentJsonExtensions.AsyncEnumerable.cs
Source:
HttpContentJsonExtensions.AsyncEnumerable.cs
Source:
HttpContentJsonExtensions.AsyncEnumerable.cs

Reads the HTTP content and returns the value that results from deserializing the content as JSON in an async enumerable operation.

C#
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);

Type Parameters

TValue

The target type to deserialize to.

Parameters

content
HttpContent

The content to read from.

options
JsonSerializerOptions

Options to control the behavior during deserialization. The default options are those specified by Web.

cancellationToken
CancellationToken

Returns

An IAsyncEnumerable<T> that represents the deserialized response body.

Exceptions

The content is null.

The cancellation token was canceled. This exception is stored into the returned task.

Applies to

.NET 9 and other versions
Product Versions
.NET 8 (package-provided), 8, 9 (package-provided), 9
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided)

ReadFromJsonAsAsyncEnumerable<TValue>(HttpContent, JsonTypeInfo<TValue>, CancellationToken)

Source:
HttpContentJsonExtensions.AsyncEnumerable.cs
Source:
HttpContentJsonExtensions.AsyncEnumerable.cs
Source:
HttpContentJsonExtensions.AsyncEnumerable.cs
Source:
HttpContentJsonExtensions.AsyncEnumerable.cs

Reads the HTTP content and returns the value that results from deserializing the content as JSON in an async enumerable operation.

C#
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);

Type Parameters

TValue

The target type to deserialize to.

Parameters

content
HttpContent

The content to read from.

jsonTypeInfo
JsonTypeInfo<TValue>

The JsonTypeInfo used to control the deserialization behavior.

cancellationToken
CancellationToken

Returns

An IAsyncEnumerable<T> that represents the deserialized response body.

Exceptions

The content is null.

The cancellation token was canceled. This exception is stored into the returned task.

Applies to

.NET 9 and other versions
Product Versions
.NET 8 (package-provided), 8, 9 (package-provided), 9
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided)