1 //StreamRead来读取一个文件 2 using (StreamReader sr = new StreamReader(@"C:\Users\wbrm\Desktop\新建文本文档.txt", Encoding.Default)) 3 { 4 while (!sr.EndOfStream)//循环的度 5 { 6 Console.WriteLine(sr.ReadLine()); 7 } 8 } 9 Console.ReadKey();
1 //StreamRead来读取一个文件 2 using (StreamReader sr = new StreamReader(@"C:\Users\wbrm\Desktop\新建文本文档.txt", Encoding.Default)) 3 { 4 while (!sr.EndOfStream)//循环的度 5 { 6 Console.WriteLine(sr.ReadLine()); 7 } 8 } 9 Console.ReadKey();