StreamCopyOperation.CopyToAsync 方法

定义

重载

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

从源流中异步读取给定的字节数,并将其写入另一个流。

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

使用指定的缓冲区大小,异步读取源流中的给定字节数,并将其写入另一个流。

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

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

从源流中异步读取给定的字节数,并将其写入另一个流。

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

参数

source
Stream

将从中复制内容的流。

destination
Stream

当前流的内容将复制到的流。

count
Nullable<Int64>

要复制的字节数。

cancel
CancellationToken

要监视取消请求的标记。 默认值是 None

返回

表示异步复制操作的任务。

适用于

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

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

使用指定的缓冲区大小,异步读取源流中的给定字节数,并将其写入另一个流。

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

参数

source
Stream

将从中复制内容的流。

destination
Stream

当前流的内容将复制到的流。

count
Nullable<Int64>

要复制的字节数。

bufferSize
Int32

缓冲区的大小(以字节为单位)。 此值必须大于零。 默认大小为 4096。

cancel
CancellationToken

要监视取消请求的标记。 默认值是 None

返回

表示异步复制操作的任务。

适用于