Windows Dev Center

BinaryWriter.Write Method (Char)

Writes a Unicode character to the current stream and advances the current position of the stream in accordance with the Encoding used and the specific characters being written to the stream.

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

public virtual void Write(
	char ch
)

Parameters

ch
Type: System.Char
The non-surrogate, Unicode character to write.

ExceptionCondition
IOException

An I/O error occurs.

ObjectDisposedException

The stream is closed.

ArgumentException

ch is a single surrogate character.

Because of data formatting conflicts, using this method with the following encodings is not recommended:

  • UTF-7

  • ISO-2022-JP

  • ISCII

Unicode surrogate characters must be written out as pairs together in the same call, not individually. If you require support for surrogate pairs in your application, consider using a character array and the Write method overload.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2015 Microsoft