System.IO.FileStream.Length Property

Gets the length in bytes of the stream.

Syntax

public override long Length { get; }

Value

A long value containing the length of the stream in bytes.

Exceptions

TypeReason
NotSupportedException FileStream.CanSeek for this stream is false.
System.IO.IOExceptionAn I/O error occurred, such as the file being closed.

Remarks

For a list of common file and directory operations, see Common I/O Tasks.

Requirements

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