Skip to content

StreamExtensions.ReadExactly Method ​

Definition ​

Reads exactly length bytes from the stream, throwing EndOfStreamException if the end of the stream has been reached.

c#
public static Byte[] ReadExactly(this Stream stream, int length);

View source

Parameters ​

NameTypeDescription
streamStream
lengthInt32The number of bytes to read.

Returns ​

Byte[]

A byte array containing the bytes read from the stream.