Share via


StreamCopyOperation.CopyToAsync Method

Definition

Overloads

CopyToAsync(Stream, Stream, Nullable<Int64>, CancellationToken)

Asynchronously reads the given number of bytes from the source stream and writes them to another stream.

CopyToAsync(Stream, Stream, Nullable<Int64>, Int32, CancellationToken)

Asynchronously reads the given number of bytes from the source stream and writes them to another stream, using a specified buffer size.

CopyToAsync(Stream, Stream, Nullable<Int64>, CancellationToken)

Source:
StreamCopyOperation.cs
Source:
StreamCopyOperation.cs
Source:
StreamCopyOperation.cs

Asynchronously reads the given number of bytes from the source stream and writes them to another stream.

public:
 static System::Threading::Tasks::Task ^ CopyToAsync(System::IO::Stream ^ source, System::IO::Stream ^ destination, Nullable<long> count, System::Threading::CancellationToken cancel);
public static System.Threading.Tasks.Task CopyToAsync (System.IO.Stream source, System.IO.Stream destination, long? count, System.Threading.CancellationToken cancel);
static member CopyToAsync : System.IO.Stream * System.IO.Stream * Nullable<int64> * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Shared Function CopyToAsync (source As Stream, destination As Stream, count As Nullable(Of Long), cancel As CancellationToken) As Task

Parameters

source
Stream

The stream from which the contents will be copied.

destination
Stream

The stream to which the contents of the current stream will be copied.

count
Nullable<Int64>

The count of bytes to be copied.

cancel
CancellationToken

The token to monitor for cancellation requests. The default value is None.

Returns

A task that represents the asynchronous copy operation.

Applies to

CopyToAsync(Stream, Stream, Nullable<Int64>, Int32, CancellationToken)

Source:
StreamCopyOperation.cs
Source:
StreamCopyOperation.cs
Source:
StreamCopyOperation.cs

Asynchronously reads the given number of bytes from the source stream and writes them to another stream, using a specified buffer size.

public:
 static System::Threading::Tasks::Task ^ CopyToAsync(System::IO::Stream ^ source, System::IO::Stream ^ destination, Nullable<long> count, int bufferSize, System::Threading::CancellationToken cancel);
public static System.Threading.Tasks.Task CopyToAsync (System.IO.Stream source, System.IO.Stream destination, long? count, int bufferSize, System.Threading.CancellationToken cancel);
static member CopyToAsync : System.IO.Stream * System.IO.Stream * Nullable<int64> * int * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Shared Function CopyToAsync (source As Stream, destination As Stream, count As Nullable(Of Long), bufferSize As Integer, cancel As CancellationToken) As Task

Parameters

source
Stream

The stream from which the contents will be copied.

destination
Stream

The stream to which the contents of the current stream will be copied.

count
Nullable<Int64>

The count of bytes to be copied.

bufferSize
Int32

The size, in bytes, of the buffer. This value must be greater than zero. The default size is 4096.

cancel
CancellationToken

The token to monitor for cancellation requests. The default value is None.

Returns

A task that represents the asynchronous copy operation.

Applies to