BinaryWriter.Write Method (String)

July 28, 2014

Writes a length-prefixed string to this stream in the current encoding of the BinaryWriter, 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(
	string value
)

Parameters

value
Type: System.String
The value to write.

ExceptionCondition
IOException

An I/O error occurs.

ArgumentNullException

value is null.

ObjectDisposedException

The stream is closed.

A length-prefixed string represents the string length by prefixing to the string a single byte or word that contains the length of that string. This method first writes the length of the string as a UTF-7 encoded unsigned integer, and then writes that many characters to the stream by using the BinaryWriter instance's current encoding.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2014 Microsoft