Method CopyToSyncAsAsync
CopyToSyncAsAsync(Stream, int, CancellationToken)
For known destination classes that are in-memory, we can optimize the copy operation by copying synchronously instead of asynchronously.
protected Task CopyToSyncAsAsync(Stream destination, int bufferSize, CancellationToken cancellationToken)
Parameters
destination
StreamThe destination stream to copy the contents of this stream to.
bufferSize
intThe size of the buffer to use for copying the stream contents.
cancellationToken
CancellationTokenThe token to monitor for cancellation requests.