語言

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 操作完成時更新。

你必須用這個EndRead電話來IAsyncResult查詢讀取了多少位元組。

適用於