NetworkStream.CanRead Property


Gets a value that indicates whether the NetworkStream supports reading.

 virtual property bool CanRead { bool get(); };
public override bool CanRead { get; }
member this.CanRead : bool
Public Overrides ReadOnly Property CanRead As Boolean

Property Value


true if data can be read from the stream; otherwise, false. The default value is true.


If CanRead is true, NetworkStream allows calls to the Read method. Provide the appropriate FileAccess enumerated value in the constructor to set the readability and writability of the NetworkStream.


The CanRead property is set when the NetworkStream is initialized. Changes in the underlying Socket's state (eg. closure) do not affect the value of CanRead.

Applies to

See also