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

定义

开始执行异步写入操作。Begins an asynchronous write operation. (请考虑改用 WriteAsync(Byte[], Int32, Int32, CancellationToken)。)(Consider using WriteAsync(Byte[], Int32, Int32, CancellationToken) instead.)

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);
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[]

要从中写入数据的缓冲区。The buffer to write data from.

offset
Int32

buffer 中的字节偏移量,从此处开始写入。The byte offset in buffer from which to begin writing.

count
Int32

要写入的最大字节数。The maximum number of bytes to write.

callback
AsyncCallback

可选的异步回调,将在写入完成时调用。An optional asynchronous callback, to be called when the write is complete.

state
Object

用户提供的对象,用于将此特定异步写入请求与其他请求区分开来。A user-provided object that distinguishes this particular asynchronous write request from other requests.

返回

表示异步写入的 IAsyncResult(可能仍处于挂起状态)。An IAsyncResult that represents the asynchronous write, which could still be pending.

异常

尝试进行的异步写入超过了内存流的结尾,或者发生了磁盘错误。Attempted an asynchronous write past the end of the memory stream, or a disk error occurred.

一个或多个自变量无效。One or more of the arguments is invalid.

在内存流关闭后调用了方法。Methods were called after the memory stream was closed.

当前内存流实现不支持写入操作。The current memory stream implementation does not support the write operation.

注解

有关此方法的其他用法信息,请参阅 BeginWrite 注释。Refer to the BeginWrite remarks for additional usage information for this method.

适用于