How to efficiently read only last line of the text file

前端 未结 3 412
盖世英雄少女心
盖世英雄少女心 2021-01-18 18:48

Need to get just last line from big log file. What is the best way to do that?

3条回答
  •  情深已故
    2021-01-18 19:31

    Or you can do it two line (.Net 4 only)

    var lines = File.ReadLines(path);
    string line = lines.Last();
    

提交回复
热议问题