System.IO.FileStream.CanRead Property

Gets a value indicating whether the current stream supports reading.

Syntax

public override bool CanRead { get; }

Value

true if the stream supports reading; false if the stream is closed or was opened with write-only access.

Remarks

If a class derived from System.IO.Stream does not support reading, calls to the FileStream.Read(Byte[], int, int), FileStream.ReadByte, and FileStream.BeginRead(Byte[], int, int, AsyncCallback, object) methods throw a NotSupportedException.

If the stream is closed, this property returns false.

Requirements

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