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.IOAssembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax public virtual byte[] ReadBytes(
int count
)
Parameters
- count
- Type: SystemInt32
The number of bytes to read.
Return Value
Type:
ByteA 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 Exception | Condition |
---|
ArgumentException | The number of decoded characters to read is greater than count. This can happen if a Unicode decoder returns fallback characters or a surrogate pair. |
IOException | An I/O error occurs. |
ObjectDisposedException | The stream is closed. |
ArgumentOutOfRangeException | count is negative. |
See Also