I need to delete a certain line from a text file. What is the most efficient way of doing this? File can be potentially large(over million records).
UPDATE: below is
In my blog, I have benchmarked various I/O methods from C# in order to determine the most efficient way of doing file I/O. In general, you are better off using the Windows ReadFile and WriteFile functions. The next fastest way to read files in is through FileStream. To get good performance, read the files in blocks at a time instead of a line at a time and then do your own parsing. The code that you can download from my blog gives you an example on how to do this. There is also a C# class that encapsulates the Windows ReadFile / WriteFile functionality and is quite easy to use. See my blog for details at:
http://designingefficientsoftware.wordpress.com/2011/03/03/efficient-file-io-from-csharp
Bob Bryan MCSD