IsolatedStorageFileStream.BeginRead Metodo

Definizione

Avvia una lettura asincrona.

public:
 override IAsyncResult ^ BeginRead(cli::array <System::Byte> ^ array, int offset, int numBytes, AsyncCallback ^ userCallback, System::Object ^ stateObject);
public:
 override IAsyncResult ^ BeginRead(cli::array <System::Byte> ^ buffer, int offset, int numBytes, AsyncCallback ^ userCallback, System::Object ^ stateObject);
public override IAsyncResult BeginRead(byte[] array, int offset, int numBytes, AsyncCallback? userCallback, object? stateObject);
public override IAsyncResult BeginRead(byte[] buffer, 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
Public Overrides Function BeginRead (array As Byte(), offset As Integer, numBytes As Integer, userCallback As AsyncCallback, stateObject As Object) As IAsyncResult
Public Overrides Function BeginRead (buffer As Byte(), offset As Integer, numBytes As Integer, userCallback As AsyncCallback, stateObject As Object) As IAsyncResult

Parametri

bufferarray
Byte[]

Buffer in cui leggere i dati.

offset
Int32

Offset di byte in in buffer corrispondenza del quale iniziare la lettura.

numBytes
Int32

Numero massimo di byte da leggere.

userCallback
AsyncCallback

Metodo da chiamare al termine dell'operazione di lettura asincrona. Questo parametro è facoltativo.

stateObject
Object

Stato della lettura asincrona.

Valori restituiti

Oggetto IAsyncResult che rappresenta la lettura asincrona, che probabilmente è ancora in sospeso. Questa IAsyncResult operazione deve essere passata al metodo del EndRead(IAsyncResult) flusso per determinare il numero di byte letti. Questa operazione può essere eseguita dallo stesso codice che ha chiamato BeginRead(Byte[], Int32, Int32, AsyncCallback, Object) o in un callback passato a BeginRead(Byte[], Int32, Int32, AsyncCallback, Object).

Eccezioni

È stata tentata una lettura asincrona oltre la fine del file.

Commenti

La posizione corrente nel flusso viene aggiornata quando si rilascia la lettura asincrona o la scrittura, non quando l'operazione di I/O viene completata.

È necessario chiamare EndRead con questo IAsyncResult per scoprire quanti byte sono stati letti.

Si applica a