System.IO.Stream.Length Property

When overridden in a derived class, gets the length in bytes of the stream.

Syntax

public abstract long Length { get; }

Value

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

Exceptions

TypeReason
NotSupportedExceptionThe stream does not support seeking.
ObjectDisposedExceptionThe stream is closed.

Remarks

Note: Use the Stream.CanSeek property to determine whether the current instance supports seeking.

Operation
This property is read-only.

Requirements

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