Use a StringReader to read from the string
Imports System
Imports System.IO
Imports System.Text
Public Class MainClass
Shared Sub Main()
' Use a StringWriter to write into a string.
Dim string_writer As New StringWriter()
string_writer.WriteLine("www.java2s.com")
string_writer.WriteLine("www.java2s.com")
' Use a StringReader to read from the string.
Dim string_reader As New StringReader(string_writer.ToString)
string_writer.Close()
Console.WriteLine(string_reader.ReadLine())
Console.WriteLine(string_reader.ReadToEnd())
string_reader.Close()
End Sub
End Class
Related examples in the same category