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

Parâmetros

buffer
Byte[]

O buffer para ler os dados.The buffer to read the data into.

offset
Int32

O deslocamento de bytes no buffer no qual será iniciada a gravação da leitura de dados no fluxo de memória.The byte offset in buffer at which to begin writing data read from the memory stream.

count
Int32

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

callback
AsyncCallback

Um retorno de chamada assíncrono opcional, a ser chamado quando a leitura for concluída.An optional asynchronous callback, to be called when the read is complete.

state
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 IAsyncResult que representa a operação de leitura assíncrona, que ainda pode estar pendente.An IAsyncResult that represents the asynchronous read, which could still be pending.

Exceções

Houve uma tentativa de leitura assíncrona após o final do fluxo de memória ou ocorreu um erro de disco.Attempted an asynchronous read past the end of the memory stream, or a disk error occurred.

Um ou mais argumentos são inválidos.One or more of the arguments is invalid.

Foram chamados métodos depois que o fluxo de memória foi fechado.Methods were called after the memory stream was closed.

A implementação do fluxo de memória atual não dá suporte à operação de leitura.The current memory stream implementation does not support the read operation.

Comentários

Consulte os BeginRead comentários para obter informações adicionais sobre o uso deste método.Refer to the BeginRead remarks for additional usage information for this method.

Aplica-se a