c# 读取txt方法
string strLine; try { FileStream aFile = new FileStream("Log.txt", FileMode.Open); StreamReader sr = new StreamReader(aFile); strLine = sr.ReadLine(); //Read data in line by line 这个兄台看的懂吧~一行一行的读取 if (strLine != null) { // Console.WriteLine(strLine); // string Line = sr.ReadLine(); MessageBox.Show(strLine); } sr.Close(); } catch (IOException ex) { Console.WriteLine("An IOException has been thrown!"); Console.WriteLine(ex.ToString()); Console.ReadLine(); return; }