Stream.CanRead Property tells whether the current stream supports reading. : Stream « File Directory « VB.Net






Stream.CanRead Property tells whether the current stream supports reading.

 

Imports System
Imports System.IO

Class TestRW

    Public Shared Sub Main()
        Dim fs As New FileStream("MyFile.txt", FileMode.OpenOrCreate, FileAccess.Read)
        If fs.CanRead And fs.CanWrite Then
            Console.WriteLine("MyFile.txt can be both written to and read from.")
        Else
            If fs.CanRead Then
                Console.WriteLine("MyFile.txt is not writable.")
            End If
        End If
    End Sub
End Class

   
  








Related examples in the same category

1.Stream.CanWrite Property tells whether the current stream supports writing.
2.Stream.CopyTo Method reads all the bytes from the current stream and writes them to the destination stream.
3.Reads a maximum of count characters from the current stream into buffer
4.Stream.Read Method reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.
5.Open a stream as ASCII
6.GZipStream Class
7.Compress streams
8.Decompress streams.
9.Stream.CanWrite Property tells whether the current stream supports writing.