How to read last “n” lines of log file

前端 未结 7 1232
轮回少年
轮回少年 2020-12-03 14:24

need a snippet of code which would read out last \"n lines\" of a log file. I came up with the following code from the net.I am kinda new to C sharp. Since the log file migh

7条回答
  •  难免孤独
    2020-12-03 14:47

    Something that you can now do very easily in C# 4.0 (and with just a tiny bit of effort in earlier versions) is use memory mapped files for this type of operation. Its ideal for large files because you can map just a portion of the file, then access it as virtual memory.

    There is a good example here.

提交回复
热议问题