Click or drag to resize

DelegatingStreamCopyToAsync Method (Stream, Int32, CancellationToken)

Asynchronously reads the bytes from the current stream and writes them to another stream, using a specified buffer size and cancellation token.

Namespace:  MongoDB.Driver.GridFS
Assembly:  MongoDB.Driver.GridFS (in MongoDB.Driver.GridFS.dll) Version: 2.12.2+a4a3888f4fb51bb518b1eb5002effc2d47f2ea6a
public override Task CopyToAsync(
	Stream destination,
	int bufferSize,
	CancellationToken cancellationToken


Type: System.IOStream
The stream to which the contents of the current stream will be copied.
Type: SystemInt32
The size, in bytes, of the buffer. This value must be greater than zero. The default size is 81920.
Type: System.ThreadingCancellationToken
The token to monitor for cancellation requests. The default value is None.

Return Value

Type: Task
A task that represents the asynchronous copy operation.
ArgumentNullExceptiondestination is .
ArgumentOutOfRangeExceptionbuffersize is negative or zero.
ObjectDisposedExceptionEither the current stream or the destination stream is disposed.
NotSupportedExceptionThe current stream does not support reading, or the destination stream does not support writing.
See Also