Bagikan melalui


FileStream.BeginRead(Byte[], Int32, Int32, AsyncCallback, Object) Metode

Definisi

Memulai operasi baca asinkron. Pertimbangkan untuk menggunakan ReadAsync(Byte[], Int32, Int32, CancellationToken) sebagai gantinya.

public:
 override IAsyncResult ^ BeginRead(cli::array <System::Byte> ^ array, int offset, int numBytes, AsyncCallback ^ callback, System::Object ^ state);
public:
 override IAsyncResult ^ BeginRead(cli::array <System::Byte> ^ buffer, int offset, int count, AsyncCallback ^ callback, System::Object ^ state);
public:
 override IAsyncResult ^ BeginRead(cli::array <System::Byte> ^ array, int offset, int numBytes, AsyncCallback ^ userCallback, System::Object ^ stateObject);
public override IAsyncResult BeginRead (byte[] array, int offset, int numBytes, 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);
public override IAsyncResult BeginRead (byte[] array, int offset, int numBytes, AsyncCallback callback, object state);
public override IAsyncResult BeginRead (byte[] array, int offset, int numBytes, AsyncCallback callback, object? state);
public override IAsyncResult BeginRead (byte[] array, 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
override this.BeginRead : byte[] * int * int * AsyncCallback * obj -> IAsyncResult
Public Overrides Function BeginRead (array As Byte(), offset As Integer, numBytes As Integer, callback As AsyncCallback, state As Object) As IAsyncResult
Public Overrides Function BeginRead (buffer As Byte(), offset As Integer, count As Integer, callback As AsyncCallback, state As Object) As IAsyncResult
Public Overrides Function BeginRead (array As Byte(), offset As Integer, numBytes As Integer, userCallback As AsyncCallback, stateObject As Object) As IAsyncResult

Parameter

arraybuffer
Byte[]

Buffer untuk membaca data.

offset
Int32

Offset byte untuk array mulai membaca.

numBytescount
Int32

Jumlah maksimum byte yang akan dibaca.

callbackuserCallback
AsyncCallback

Metode yang akan dipanggil ketika operasi baca asinkron selesai.

statestateObject
Object

Objek yang disediakan pengguna yang membedakan permintaan baca asinkron khusus ini dari permintaan lain.

Mengembalikan

Objek yang mereferensikan pembacaan asinkron.

Pengecualian

Panjang array minus offset kurang dari numBytes.

arrayadalah null.

offset atau numBytes negatif.

Pembacaan asinkron dicoba melewati akhir file.

Berlaku untuk