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
Text files are sequential, so when deleting a line, you'll have to move all the following lines up. You can use file mapping (a win32 api that you can call through PInvoke) to make this operation a bit less painfull, but you surelly should considere using a non sequential structure for you file so that you can mark a line as deleted without realy removing it from the file... Especially if it should happen frenquently.
If I've remember File Mapping Api should be added to .Net 4.