Windows Dev Center

BinaryReader Constructor (Stream, Encoding, Boolean)

Initializes a new instance of the BinaryReader class based on the supplied stream, a specific character encoding, and a value that specifies whether to leave the stream open.

Namespace:  System.IO
Assembly:  mscorlib (in mscorlib.dll)

public BinaryReader(
	Stream input,
	Encoding encoding,
	bool leaveOpen
)

Parameters

input
Type: System.IO.Stream
The input stream.
encoding
Type: System.Text.Encoding
The character encoding to use.
leaveOpen
Type: System.Boolean
true to leave the stream open; otherwise, false.

ExceptionCondition
ArgumentException

The stream does not support reading, or the stream is already closed.

ArgumentNullException

input or encoding is null.

When leaveOpen is true, the stream is left open after the BinaryReader object is disposed.

Windows Phone OS

Supported in: 8.1, 8.0

Show:
© 2015 Microsoft