HttpContent.ReadAsStream Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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.
public:
System::IO::Stream ^ ReadAsStream();
public System.IO.Stream ReadAsStream ();
member this.ReadAsStream : unit -> System.IO.Stream
Public Function ReadAsStream () As Stream
Returns
The stream that represents the HTTP content.
Applies to
ReadAsStream(CancellationToken)
- Source:
- HttpContent.cs
- Source:
- HttpContent.cs
- Source:
- HttpContent.cs
Serializes the HTTP content and returns a stream that represents the content.
public:
System::IO::Stream ^ ReadAsStream(System::Threading::CancellationToken cancellationToken);
public System.IO.Stream ReadAsStream (System.Threading.CancellationToken cancellationToken);
member this.ReadAsStream : System.Threading.CancellationToken -> System.IO.Stream
Public Function ReadAsStream (cancellationToken As CancellationToken) As Stream
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.