forum

home / developersection / forums / delete the first line of a text file without reading it

Delete the first line of a text file without reading it

marcel ethan 2083 30-Jan-2014

I'm working with a very large text file (around 70 thousand lines) and I want to remove the top line.

Clearly, loading the entire thing into memory, deleting the top line, then re-writing the whole thing again is inefficiant:

var lines = File.ReadLines(accountFileLocation.Text).Skip(1);

File.WriteAllLines("output.txt", lines);

Is there any other way to do it?


c# c# 
Updated on 30-Jan-2014
marcel ethan

Other


Message
Can you answer this question?

Answer

1 Answers

Liked By