BinaryReader Constructor (Stream, Encoding, Boolean)
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
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.
Assembly: mscorlib (in mscorlib.dll)
'Declaration Public Sub New ( _ input As Stream, _ encoding As Encoding, _ leaveOpen As Boolean _ )
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.
| Exception | Condition |
|---|---|
| ArgumentException | The stream does not support reading, or the stream is already closed. |
| ArgumentNullException | input or encoding is Nothing. |
When leaveOpen is true, the stream is left open after the BinaryReader object is disposed.