I tried to remove a line from text file which contains a particular word. However I need a better approach to delete the line.
Here is the code I used:
var oldLines = System.IO.File.ReadAllLines(filepath);
var newLines = oldLines.Where(line1 => !line1.Contains("Value"));
System.IO.File.WriteAllLines(filepath, newLines);
By using this my task was completed, but with the following performance issues: If the file contains 10 lakhs lines it must read 10lakhs line and write 10 lakhs lines, so it takes more time.