IsolatedStorageFileStream.BeginRead 方法

定义

开始异步读。

public:
 override IAsyncResult ^ BeginRead(cli::array <System::Byte> ^ array, int offset, int numBytes, AsyncCallback ^ userCallback, System::Object ^ stateObject);
public:
 override IAsyncResult ^ BeginRead(cli::array <System::Byte> ^ buffer, int offset, int numBytes, AsyncCallback ^ userCallback, System::Object ^ stateObject);
public override IAsyncResult BeginRead (byte[] array, int offset, int numBytes, AsyncCallback? userCallback, object? stateObject);
public override IAsyncResult BeginRead (byte[] buffer, int offset, int numBytes, AsyncCallback userCallback, object stateObject);
override this.BeginRead : byte[] * int * int * AsyncCallback * obj -> IAsyncResult
override this.BeginRead : byte[] * int * int * AsyncCallback * obj -> IAsyncResult
Public Overrides Function BeginRead (array As Byte(), offset As Integer, numBytes As Integer, userCallback As AsyncCallback, stateObject As Object) As IAsyncResult
Public Overrides Function BeginRead (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 必须传递到该流的 EndRead(IAsyncResult) 方法以确定读取的字节数。 这可以通过调用 BeginRead(Byte[], Int32, Int32, AsyncCallback, Object) 的相同代码来完成,或在传递给 BeginRead(Byte[], Int32, Int32, AsyncCallback, Object) 的回调中完成。

例外

尝试在文件的末尾后进行异步读取。

注解

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

必须使用此IAsyncResult调用EndRead来找出读取的字节数。

适用于