BinaryWriter Constructor (Stream, Encoding)
[ 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 and a specific character encoding.
Assembly: mscorlib (in mscorlib.dll)
Parameters
- output
- Type: System.IO.Stream
The output stream.
- encoding
- Type: System.Text.Encoding
The character encoding to use.
| Exception | Condition |
|---|---|
| ArgumentException | The stream does not support writing, or the stream is already closed. |
| ArgumentNullException | output or encoding is null. |
The stream is closed when the BinaryWriter object is disposed.
Show: