Will the below method overwrite the output file (process.txt) ?
private static void CompareOrig()
{
File.WriteAllLines("process.txt",
File.ReadAllLines("process2.txt").Except(File.ReadAllLines("process.txt")));
}
Added Info:
The problem is that when the lines are read from process2.txt, they are written to the process.txt file, hence overwriting all existing data in that file. Instead how could I append the output to process.txt? e.g.
File.AppendAllText("process.txt")
Yes
Use another filename for writing.
If you meant “will it be overwritten before it is completely read” then the answer is No and you have no problem.
But splitting this up with one or two variables would make it so much more readable. If it makes you doubt, so will it make the reader. Over and over again.