HttpContent.ReadAsStream Method

Definition

Serializes the HTTP content and returns a stream that represents the content.

Overloads

ReadAsStream()

Serializes the HTTP content and returns a stream that represents the content.

ReadAsStream(CancellationToken)

Serializes the HTTP content and returns a stream that represents the content.

Remarks

Note that this method will internally buffer the content unless CreateContentReadStream(CancellationToken) has been implemented to do otherwise. For example, when using HttpClient, a method such as SendAsync returns a class derived from HttpContent that conditionally buffers based on what's passed for the completionOption parameter.

ReadAsStream()

Source:
HttpContent.cs
Source:
HttpContent.cs
Source:
HttpContent.cs

Serializes the HTTP content and returns a stream that represents the content.

C#
public System.IO.Stream ReadAsStream();

Returns

The stream that represents the HTTP content.

Applies to

.NET 10 a ďalšie verzie
Produkt Verzie
.NET 5, 6, 7, 8, 9, 10

ReadAsStream(CancellationToken)

Source:
HttpContent.cs
Source:
HttpContent.cs
Source:
HttpContent.cs

Serializes the HTTP content and returns a stream that represents the content.

C#
public System.IO.Stream ReadAsStream(System.Threading.CancellationToken cancellationToken);

Parameters

cancellationToken
CancellationToken

The cancellation token to cancel the operation.

Returns

The stream that represents the HTTP content.

Exceptions

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

Applies to

.NET 10 a ďalšie verzie
Produkt Verzie
.NET 5, 6, 7, 8, 9, 10