Редагувати

Поділитися через


IsolatedStorageFileStream.BeginRead Method

Definition

Begins an asynchronous read.

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

Parameters

bufferarray
Byte[]

The buffer to read data into.

offset
Int32

The byte offset in buffer at which to begin reading.

numBytes
Int32

The maximum number of bytes to read.

userCallback
AsyncCallback

The method to call when the asynchronous read operation is completed. This parameter is optional.

stateObject
Object

The status of the asynchronous read.

Returns

An IAsyncResult object that represents the asynchronous read, which is possibly still pending. This IAsyncResult must be passed to this stream's EndRead(IAsyncResult) method to determine how many bytes were read. This can be done either by the same code that called BeginRead(Byte[], Int32, Int32, AsyncCallback, Object) or in a callback passed to BeginRead(Byte[], Int32, Int32, AsyncCallback, Object).

Exceptions

An asynchronous read was attempted past the end of the file.

Remarks

The current position in the stream is updated when you issue the asynchronous read or write, not when the I/O operation completes.

You must call EndRead with this IAsyncResult to find out how many bytes were read.

Applies to