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

Definição

Inicia uma operação de leitura assíncrona.Begins an asynchronous read operation. Considere o uso de ReadAsync(Byte[], Int32, Int32, CancellationToken) em seu lugar.Consider using ReadAsync(Byte[], Int32, Int32, CancellationToken) instead.

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[] 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[]

O buffer no qual os dados serão lidos.The buffer to read data into.

offset
Int32

O deslocamento de bytes em array no qual será iniciada a leitura.The byte offset in array at which to begin reading.

numBytescount
Int32

O número máximo de bytes a serem lidos.The maximum number of bytes to read.

callbackuserCallback
AsyncCallback

O método a ser chamado quando a operação de leitura assíncrona for concluída.The method to be called when the asynchronous read operation is completed.

statestateObject
Object

Um objeto fornecido pelo usuário que distingue essa solicitação de leitura assíncrona específica de outras solicitações.A user-provided object that distinguishes this particular asynchronous read request from other requests.

Retornos

IAsyncResult

Um objeto que faz referência à leitura assíncrona.An object that references the asynchronous read.

Exceções

O tamanho da matriz menos offset é menor que numBytes.The array length minus offset is less than numBytes.

array é null.array is null.

offset ou numBytes é negativo.offset or numBytes is negative.

Ocorreu uma tentativa de leitura assíncrona após o final do arquivo.An asynchronous read was attempted past the end of the file.

Aplica-se a