BinaryReader.ReadBytes Method

May 11, 2014

Reads the specified number of bytes from the current stream into a byte array and advances the current position by that number of bytes.

Namespace:  System.IO
Assembly:  mscorlib (in mscorlib.dll)

'Declaration
Public Overridable Function ReadBytes ( _
	count As Integer _
) As Byte()

Parameters

count
Type: System.Int32
The number of bytes to read.

Return Value

Type: System.Byte ()
A byte array containing data read from the underlying stream. This might be less than the number of bytes requested if the end of the stream is reached.

ExceptionCondition
IOException

An I/O error occurs.

ObjectDisposedException

The stream is closed.

ArgumentOutOfRangeException

count is negative.

BinaryReader does not restore the file position after an unsuccessful read operation.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2014 Microsoft