using System;
using System.IO;
class Program
{
static void Main()
{
string line = "";
using (StreamReader sr = new StreamReader(@"C:\test.txt"))
{
while ((line = sr.ReadLine()) != null)
{
Console.WriteLine(line);
}
}
Console.ReadKey();
}
}
|
Imports System.IO
Class Program
Private Shared Sub Main()
Dim line As String = ""
Using sr As New StreamReader("C:\test.txt")
While (InlineAssignHelper(line, sr.ReadLine())) IsNot Nothing
Console.WriteLine(line)
End While
End Using
Console.ReadKey()
End Sub
Private Shared Function InlineAssignHelper(Of T)(ByRef target As T, value As T) As T
target = value
Return value
End Function
End Class
|