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.

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

View source

Parameters

Name Type Description
stream Stream
length Int32 The number of bytes to read.

Returns

Byte[]

A byte array containing the bytes read from the stream.