Partager via


FileStream.BeginRead(Byte[], Int32, Int32, AsyncCallback, Object) Méthode

Définition

Débute une opération de lecture asynchrone. Utilisez ReadAsync(Byte[], Int32, Int32, CancellationToken) à la place.

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

Paramètres

arraybuffer
Byte[]

Mémoire tampon dans laquelle lire les données.

offset
Int32

Dans array, décalage d'octet auquel commencer la lecture.

numBytescount
Int32

Nombre maximal d'octets à lire.

callbackuserCallback
AsyncCallback

Méthode à appeler quand l'opération de lecture asynchrone est terminée.

statestateObject
Object

Objet fourni par l'utilisateur qui distingue cette requête de lecture asynchrone des autres requêtes.

Retours

Objet référence la lecture asynchrone.

Exceptions

La longueur du tableau moins offset est inférieure à numBytes.

array a la valeur null.

offset ou numBytes est un nombre négatif.

Une lecture asynchrone a été tentée au-delà de la fin du fichier.

S’applique à