Baca dalam bahasa Inggris

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 (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);

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

Produk Versi
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1