Mono Class Library: System.IO.MemoryStream Overview | Members

System.IO.MemoryStream.WriteByte Method

Writes a byte to the current stream at the current position. [Edit]

public override void WriteByte (byte value)

Parameters

value
The byte to write. [Edit]

Exceptions

TypeReason
ObjectDisposedExceptionThe current stream is closed. [Edit]
NotSupportedException

The current stream does not support writing.

-or-

The current position is at the end of the stream, and the stream's capacity cannot be modified.

[Edit]

Remarks

Write operations at the end of a resizable System.IO.MemoryStream expand the System.IO.MemoryStream. If the write operation is successful, the current position within the stream is advanced by one byte. If an exception occurs, the position is unchanged.

If the write takes place immediately following a seek beyond the end of the stream, that stream is zero-byte-extended to the new seek position before the given byte is written.

Note: Use the MemoryStream.CanWrite method to determine whether the current stream supports writing.

Note: This method overrides Stream.WriteByte(byte).

[Edit]

Requirements

Namespace: System.IO
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0