MemoryStream.BeginWrite(Byte[], Int32, Int32, AsyncCallback, Object) 方法

定义

开始异步写操作。 (请考虑改用 WriteAsync(Byte[], Int32, Int32, CancellationToken)。)

public:
 override IAsyncResult ^ BeginWrite(cli::array <System::Byte> ^ buffer, int offset, int count, AsyncCallback ^ callback, System::Object ^ state);
public override IAsyncResult BeginWrite (byte[] buffer, int offset, int count, AsyncCallback? callback, object? state);
public override IAsyncResult BeginWrite (byte[] buffer, int offset, int count, AsyncCallback callback, object state);
public override IAsyncResult BeginWrite (byte[] buffer, int offset, int count, AsyncCallback callback, object? state);
override this.BeginWrite : byte[] * int * int * AsyncCallback * obj -> IAsyncResult
Public Overrides Function BeginWrite (buffer As Byte(), offset As Integer, count As Integer, callback As AsyncCallback, state As Object) As IAsyncResult

参数

buffer
Byte[]

从中写入数据的缓冲区。

offset
Int32

buffer 中的字节偏移量,从此处开始写入。

count
Int32

最多写入的字节数。

callback
AsyncCallback

可选的异步回调,在完成写入时调用。

state
Object

一个用户提供的对象,它将该特定的异步写入请求与其他请求区别开来。

返回

IAsyncResult

表示异步写入的 IAsyncResult(可能仍处于挂起状态)。

例外

尝试进行的异步写入超过了内存流的结尾,或者发生了磁盘错误。

一个或多个自变量无效。

在内存流关闭后调用了方法。

当前内存流实现不支持写入操作。

注解

有关 BeginWrite 此方法的其他使用信息,请参阅说明。

适用于