Редагувати

Поділитися через


HttpContent.CopyTo(Stream, TransportContext, CancellationToken) Method

Definition

Serializes the HTTP content into a stream of bytes and copies it to stream.

public:
 void CopyTo(System::IO::Stream ^ stream, System::Net::TransportContext ^ context, System::Threading::CancellationToken cancellationToken);
public void CopyTo (System.IO.Stream stream, System.Net.TransportContext? context, System.Threading.CancellationToken cancellationToken);
member this.CopyTo : System.IO.Stream * System.Net.TransportContext * System.Threading.CancellationToken -> unit
Public Sub CopyTo (stream As Stream, context As TransportContext, cancellationToken As CancellationToken)

Parameters

stream
Stream

The target stream.

context
TransportContext

Information about the transport (for example, the channel binding token). This parameter may be null.

cancellationToken
CancellationToken

The cancellation token to cancel the operation.

Exceptions

The stream was null.

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

Remarks

This method uses SerializeToStream(Stream, TransportContext, CancellationToken) internally to serialize the content into the given stream. If the content has been previously buffered, for example, by calling LoadIntoBufferAsync(), the method will return the buffered content and not call the serialization method.

Applies to