BinaryWriter 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 BinaryWriter 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 ( _ output As Stream, _ encoding As Encoding, _ leaveOpen As Boolean _ )
Parameters
- output
- Type: System.IO.Stream
The output 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 writing, or the stream is already closed. |
| ArgumentNullException | output or encoding is Nothing. |
When leaveOpen is true, the stream is left open after the BinaryWriter object is disposed.