为什么在中我们要在
streamreader
前面加上using?using (StreamReader sr = new StreamReader("TestFile.txt"))
{
string line;
// Read and display lines from the file until the end of
// the file is reached.
while ((line = sr.ReadLine()) != null)
{
Console.WriteLine(line);
}
}
F1
键就能告诉你所需知道的信息。 - slugster