using (StreamReader sr = new StreamReader("test.txt"))
{
string line = null;
while (((line = sr.ReadLine())) != null)
{
Console.WriteLine(line);
}
}
或者
using (StreamReader sr = new StreamReader("test.txt"))
{
while (!sr.EndOfStream)
{
JPrint(sr.ReadLine());
}
}