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.

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

Syntax

Public Sub New ( _
    output As Stream, _
    encoding As Encoding _
)
public BinaryWriter(
    Stream output,
    Encoding encoding
)

Parameters

Exceptions

Exception Condition
ArgumentException

The stream does not support writing, or the stream is already closed.

ArgumentNullException

output or encoding is nullNothingnullptra null reference (Nothing in Visual Basic).

Remarks

The stream is closed when the BinaryWriter object is disposed.

Version Information

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Platforms

Windows Phone

See Also

Reference

BinaryWriter Class

BinaryWriter Overload

System.IO Namespace