HttpContent.ReadAsStreamAsync Method

Definition

Serialize the HTTP content and return a stream that represents the content as an asynchronous operation.

public:
 System::Threading::Tasks::Task<System::IO::Stream ^> ^ ReadAsStreamAsync();
public System.Threading.Tasks.Task<System.IO.Stream> ReadAsStreamAsync();
member this.ReadAsStreamAsync : unit -> System.Threading.Tasks.Task<System.IO.Stream>
Public Function ReadAsStreamAsync () As Task(Of Stream)

Returns

The task object representing the asynchronous operation.

Remarks

This operation will not block. The returned Task<TResult> object will complete after all of the stream that represents content has been read.

Once the operation completes, the Result property on the returned task object contains the stream that represents the HTTP content. The returned stream can then be used to read the content using various stream APIs.

This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as ArgumentException, are still thrown synchronously. For the stored exceptions, see the exceptions thrown by ReadAsStream().

Applies to