Imports System
Imports System.IO
Public Class BinaryRW
Shared Sub Main()
Dim i As Integer = 0
Dim invalidPathChars() As Char = Path.InvalidPathChars
Dim memStream As new MemoryStream()
Dim binWriter As New BinaryWriter(memStream)
For i = 0 To invalidPathChars.Length - 1
binWriter.Write(invalidPathChars(i))
Next i
Dim binReader As New BinaryReader(memStream)
memStream.Position = 0
Console.Write(binReader.ReadString())
Dim memoryData(CInt(memStream.Length - memStream.Position) - 1) As Char
For i = 0 To memoryData.Length - 1
memoryData(i) = binReader.ReadChar()
Next i
Console.WriteLine(memoryData)
End Sub
End Class