IsolatedStorageFileStream.BeginWrite 方法

定义

开始异步写。

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

参数

bufferarray
Byte[]

数据写入的缓冲区。

offset
Int32

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

numBytes
Int32

最多写入的字节数。

userCallback
AsyncCallback

异步写操作完成后调用的方法。 此参数可选。

stateObject
Object

异步写的状态。

返回

表示可能仍处于挂起状态的异步写入的 IAsyncResult。 此 IAsyncResult 必须传递到该流的 EndWrite(IAsyncResult) 方法以确保写入完成,然后相应地释放资源。 这可以通过调用 BeginWrite(Byte[], Int32, Int32, AsyncCallback, Object) 的相同代码来完成,或在传递给 BeginWrite(Byte[], Int32, Int32, AsyncCallback, Object) 的回调中完成。

例外

试图超出文件末尾进行异步写入。

注解

如果对象 IsolatedStorageFileStream 是可写的,在流末尾写入将扩展流。

发出异步读取或写入时,而不是 I/O 操作完成时,流中的当前位置会更新。

必须使用此方法返回的 对象调用 EndWriteIAsyncResult ,才能找出写入的字节数。

适用于