Click or drag to resize
BinaryReaderReadBytes 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.

Namespace: System.IO
Assembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax
C#
public virtual byte[] ReadBytes(
	int count
)

Parameters

count
Type: SystemInt32
The number of bytes to read.

Return Value

Type: 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.
Exceptions
ExceptionCondition
ArgumentExceptionThe number of decoded characters to read is greater than count. This can happen if a Unicode decoder returns fallback characters or a surrogate pair.
IOExceptionAn I/O error occurs.
ObjectDisposedExceptionThe stream is closed.
ArgumentOutOfRangeExceptioncount is negative.
See Also