BinaryWriter Constructor (Stream, Encoding, Boolean)
Collapse the table of content
Expand the table of content

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.

Namespace:  System.IO
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.

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

Windows Phone OS

Supported in: 8.1, 8.0

Show:
© 2016 Microsoft