c# 读取txt方法
生活随笔
收集整理的這篇文章主要介紹了
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;}
轉載于:https://www.cnblogs.com/MagicAsa/p/9239215.html
總結
以上是生活随笔為你收集整理的c# 读取txt方法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 应用docker化
- 下一篇: LINQ中判断日期时间段