This topic has not yet been rated - Rate this topic

FileStream.BeginRead Method

May 02, 2013

Begins an asynchronous read.

Namespace:  System.IO
Assembly:  mscorlib (in mscorlib.dll)
public override IAsyncResult BeginRead(
	byte[] array,
	int offset,
	int numBytes,
	AsyncCallback userCallback,
	Object stateObject
)

Parameters

array
Type: System.Byte []
The buffer to read data into.
offset
Type: System.Int32
The byte offset in array at which to begin reading.
numBytes
Type: System.Int32
The maximum number of bytes to read.
userCallback
Type: System.AsyncCallback
The method to be called when the asynchronous read operation is completed.
stateObject
Type: System.Object
A user-provided object that distinguishes this particular asynchronous read request from other requests.

Return Value

Type: System.IAsyncResult
An IAsyncResult that references the asynchronous read.
ExceptionCondition
ArgumentException

The array length minus offset is less than numBytes.

ArgumentNullException

array is null.

ArgumentOutOfRangeException

offset or numBytes is negative.

IOException

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

Windows Phone OS

Supported in: 8.0, 7.1, 7.0

Windows Phone

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.