System.IO.FileStream.WriteByte Method

Writes a byte to the current position in the file stream.

Syntax

public override void WriteByte (byte value)

Parameters

value
A byte to write to the stream.

Exceptions

TypeReason
System.IO.IOExceptionThe current stream is closed.
NotSupportedExceptionThe current stream does not support writing.
ObjectDisposedExceptionThe current stream is closed.

Remarks

This method overrides Stream.WriteByte(byte).

Use WriteByte to write a byte to a FileStream efficiently. If the stream is closed or not writable, an exception will be thrown.

Note:

Use the FileStream.CanWrite property to determine whether the current instance supports writing. For additional information, see Stream.CanWrite.

Requirements

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