在C#中为什么这两个代码的输出结果不同?
StreamReader test = new StreamReader(@"C:\a.txt");
while (test.ReadLine() != null)
{
Console.WriteLine(test.ReadLine());
}
而这段代码:
StreamReader test = new StreamReader(@"C:\a.txt");
string line = "";
while ((line = test.ReadLine()) != null)
{
Console.WriteLine(line);
}