c# 读取txt方法
生活随笔
收集整理的這篇文章主要介紹了
c# 读取txt方法
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
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 這個(gè)兄臺(tái)看的懂吧~一行一行的讀取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;}
轉(zhuǎn)載于:https://www.cnblogs.com/MagicAsa/p/9239215.html
總結(jié)
以上是生活随笔為你收集整理的c# 读取txt方法的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 应用docker化
- 下一篇: LINQ中判断日期时间段