BinaryWriter Constructor (Stream, Encoding)

Initializes a new instance of the BinaryWriter class based on the supplied stream and a specific character encoding.

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

public BinaryWriter(
	Stream output,
	Encoding encoding
)

Parameters

output
Type: System.IO.Stream
The output stream.
encoding
Type: System.Text.Encoding
The character encoding to use.

ExceptionCondition
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.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2015 Microsoft