IsolatedStorageFileStream.BeginRead Method

Definition

Begins an asynchronous read.

C#
public override IAsyncResult BeginRead(byte[] array, int offset, int numBytes, AsyncCallback? userCallback, object? stateObject);
C#
public override IAsyncResult BeginRead(byte[] buffer, int offset, int numBytes, AsyncCallback userCallback, object stateObject);

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

Produkt Versioner
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1