codice:
Imports System
Imports System.Collections.Generic
Imports System.Text
Namespace readLine
Class Reader
Public Shared Sub Main(ByVal args As String())
Dim theFile As System.IO.FileStream = Nothing
Dim theStream As System.IO.StreamReader = Nothing
Try
theFile = New System.IO.FileStream("C:\\prova.txt", System.IO.FileMode.Open, System.IO.FileAccess.Read)
theStream = New System.IO.StreamReader(theFile)
While Not theStream.EndOfStream
Console.WriteLine(theStream.ReadLine())
End While
Catch e As Exception
Console.Error.WriteLine(e.Message)
Finally
If theStream IsNot Nothing Then
theStream.Close()
End If
If theFile IsNot Nothing Then
theFile.Close()
End If
End Try
Console.ReadKey()
End Sub
End Class
End Namespace