System.IO.FileStream.ReadByte Method

Reads a byte from the file and advances the read position one byte.

Syntax

public override int ReadByte ()

Returns

The byte, cast to an int, or -1 if the end of the stream has been reached.

Exceptions

TypeReason
ObjectDisposedExceptionThe current stream is closed.
NotSupportedExceptionThe current stream does not support reading.

Remarks

This method overrides Stream.ReadByte.

Note:

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

Requirements

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