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

定義

開始非同步的讀取作業。 (請考慮用 ReadAsync(Byte[], Int32, Int32, CancellationToken) 替代。)

public:
 override IAsyncResult ^ BeginRead(cli::array <System::Byte> ^ buffer, int offset, int count, AsyncCallback ^ callback, System::Object ^ state);
public override IAsyncResult BeginRead (byte[] buffer, int offset, int count, AsyncCallback? callback, object? state);
public override IAsyncResult BeginRead (byte[] buffer, int offset, int count, AsyncCallback callback, object state);
public override IAsyncResult BeginRead (byte[] buffer, int offset, int count, AsyncCallback callback, object? state);
override this.BeginRead : byte[] * int * int * AsyncCallback * obj -> IAsyncResult
Public Overrides Function BeginRead (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,代表可能還在擱置中的非同步讀取。

例外狀況

嘗試進行超出記憶體資料流結尾的非同步讀取,或發生磁碟錯誤。

一或多個引數無效。

在關閉記憶體資料流後呼叫了方法。

目前的記憶體資料流實作不支援讀取作業。

備註

BeginRead如需此方法的其他使用資訊,請參閱備註。

適用於