CanRead Property
Collapse the table of content
Expand the table of content

MemoryStream.CanRead Property

Gets a value indicating whether the current stream supports reading.

[Visual Basic]
Overrides Public ReadOnly Property CanRead As Boolean
public override bool CanRead {get;}
public: __property bool get_CanRead();
public override function get CanRead() : Boolean;

Property Value

true if the stream is open.


For an example of creating a file and writing text to a file, see Writing Text to a File. For an example of reading text from a file, see Reading Text from a File. For an example of reading from and writing to a binary file, see Reading and Writing to a Newly Created Data File.

If a class derived from Stream does not support reading, calls to the Read and ReadByte methods throw a NotSupportedException.

If the stream is closed, this property returns false.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

MemoryStream Class | MemoryStream Members | System.IO Namespace | Working with I/O | Reading Text from a File | Writing Text to a File

© 2016 Microsoft