Editare

Partajați prin


MultipartContent.CreateContentReadStreamAsync Method

Definition

Overloads

CreateContentReadStreamAsync()

Serializes the HTTP content to a stream using the multipart/* encoding as an asynchronous operation.

CreateContentReadStreamAsync(CancellationToken)

Serializes the HTTP content to a stream using the multipart/* encoding as an asynchronous operation.

CreateContentReadStreamAsync()

Source:
MultipartContent.cs
Source:
MultipartContent.cs
Source:
MultipartContent.cs

Serializes the HTTP content to a stream using the multipart/* encoding as an asynchronous operation.

protected:
 override System::Threading::Tasks::Task<System::IO::Stream ^> ^ CreateContentReadStreamAsync();
protected override System.Threading.Tasks.Task<System.IO.Stream> CreateContentReadStreamAsync ();
override this.CreateContentReadStreamAsync : unit -> System.Threading.Tasks.Task<System.IO.Stream>
Protected Overrides Function CreateContentReadStreamAsync () As Task(Of Stream)

Returns

The task object representing the asynchronous operation.

Remarks

This method overrides HttpContent.CreateContentReadStreamAsync to use a custom stream that contains an array, with each HTTP content and its boundary encoded and serialized to a MemoryStream instance.

This operation will not block. The returned Task<TResult> object will complete after all of the content has been written to the memory stream.

Once the operation completes, the Task<TResult>.Result property on the returned task object contains the stream that represents the multipart/* encoded HTTP content. The returned stream can then be used to read the content using various stream APIs.

Applies to

CreateContentReadStreamAsync(CancellationToken)

Source:
MultipartContent.cs
Source:
MultipartContent.cs
Source:
MultipartContent.cs

Serializes the HTTP content to a stream using the multipart/* encoding as an asynchronous operation.

protected:
 override System::Threading::Tasks::Task<System::IO::Stream ^> ^ CreateContentReadStreamAsync(System::Threading::CancellationToken cancellationToken);
protected override System.Threading.Tasks.Task<System.IO.Stream> CreateContentReadStreamAsync (System.Threading.CancellationToken cancellationToken);
override this.CreateContentReadStreamAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.IO.Stream>
Protected Overrides Function CreateContentReadStreamAsync (cancellationToken As CancellationToken) As Task(Of Stream)

Parameters

cancellationToken
CancellationToken

The cancellation token to cancel the operation.

Returns

The task object representing the asynchronous operation.

Exceptions

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

Remarks

This method overrides HttpContent.CreateContentReadStreamAsync to use a custom stream that contains an array, with each HTTP content and its boundary encoded and serialized to a MemoryStream instance.

This operation will not block. The returned Task<TResult> object will complete after all of the content has been written to the memory stream.

Once the operation completes, the Task<TResult>.Result property on the returned task object contains the stream that represents the multipart/* encoded HTTP content. The returned stream can then be used to read the content using various stream APIs.

Applies to