IsolatedStorageFileStream.BeginRead Metodo

Definizione

Inizia 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 dei byte in buffer da cui iniziare la lettura.

numBytes
Int32

Numero massimo di byte da leggere.

userCallback
AsyncCallback

Metodo da chiamare quando l'operazione di lettura asincrona viene completata. Questo parametro è facoltativo e,

stateObject
Object

Stato della lettura asincrona.

Restituisce

Oggetto IAsyncResult che rappresenta la lettura asincrona, che probabilmente è ancora in sospeso. Per determinare il numero di byte letti, è necessario passare questo oggetto IAsyncResult al metodo EndRead(IAsyncResult) di questo flusso. È possibile eseguire questa operazione tramite lo stesso codice che ha chiamato BeginRead(Byte[], Int32, Int32, AsyncCallback, Object) o in un callback passato a BeginRead(Byte[], Int32, Int32, AsyncCallback, Object).

Eccezioni

Si è provato a eseguire la lettura asincrona oltre la fine del file.

Commenti

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

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

Si applica a