Stream.CanWrite Property tells whether the current stream supports writing. : Stream « File Directory « VB.Net






Stream.CanWrite Property tells whether the current stream supports writing.

 

Imports System
Imports System.IO

Class TestRW    

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

   
  








Related examples in the same category

1.Stream.CanRead Property tells whether the current stream supports reading.
2.Stream.CanWrite Property tells whether the current stream supports writing.
3.Stream.CopyTo Method reads all the bytes from the current stream and writes them to the destination stream.
4.Reads a maximum of count characters from the current stream into buffer
5.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.
6.Open a stream as ASCII
7.GZipStream Class
8.Compress streams
9.Decompress streams.