FileStream.BeginRead(Byte[], Int32, Int32, AsyncCallback, Object) FileStream.BeginRead(Byte[], Int32, Int32, AsyncCallback, Object) FileStream.BeginRead(Byte[], Int32, Int32, AsyncCallback, Object) FileStream.BeginRead(Byte[], Int32, Int32, AsyncCallback, Object) Method

Definition

Begins an asynchronous read operation. 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);
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

Parameters

array
Byte[]

The buffer to read data into.

offset
Int32 Int32 Int32 Int32

The byte offset in array at which to begin reading.

numBytes
Int32 Int32 Int32 Int32

The maximum number of bytes to read.

callback
AsyncCallback AsyncCallback AsyncCallback AsyncCallback

The method to be called when the asynchronous read operation is completed.

state
Object Object Object Object

A user-provided object that distinguishes this particular asynchronous read request from other requests.

Returns

An object that references the asynchronous read.

Exceptions

The array length minus offset is less than numBytes.

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

Applies to