Compartir a través de


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

Definición

Comienza una operación de lectura asincrónica. Considere usar ReadAsync(Byte[], Int32, Int32, CancellationToken) en su lugar.

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

Parámetros

arraybuffer
Byte[]

Búfer en el que se leen los datos.

offset
Int32

Desplazamiento de bytes en la array donde va a comenzar la lectura.

numBytescount
Int32

Número máximo de bytes que se pueden leer.

callbackuserCallback
AsyncCallback

Método al que se va a llamar cuando se complete la operación de lectura asincrónica.

statestateObject
Object

Objeto proporcionado por el usuario que distingue esta solicitud de lectura asincrónica de otras.

Devoluciones

Objeto que hace referencia a la lectura asincrónica.

Excepciones

La longitud de la matriz menos offset es menor que numBytes.

array es null.

offset o numBytes es negativo.

Se intentó efectuar una lectura asincrónica más allá del final del archivo.

Se aplica a