How to read text file by particular line separator character?

后端 未结 9 2013
独厮守ぢ
独厮守ぢ 2020-12-03 00:58

Reading a text file using streamreader.

using (StreamReader sr = new StreamReader(FileName, Encoding.Default))
{
     string line = sr.ReadLine();
}
<         


        
9条回答
  •  悲&欢浪女
    2020-12-03 01:44

    string text = sr.ReadToEnd();
    string[] lines = text.Split('\r');
    foreach(string s in lines)
    {
       // Consume
    }
    

提交回复
热议问题