System.IO.BinaryReader.ReadBytes Method

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

Syntax

public virtual byte[] ReadBytes (int count)

Parameters

count
The number of bytes to read. This value must be 0 or a non-negative number or an exception will occur.

Returns

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.

Remarks

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

For a list of common I/O tasks, see Common I/O Tasks.

Requirements

Namespace: System.IO
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0