I want to append lines to my file. I am using a StreamWriter:
StreamWriter file2 = new StreamWriter(@"c:\file.txt");
file2.WriteLine(someString);
file2.Close();
The output of my file should be several strings below each other, but I have only one row, which is overwritten every time I run this code.
Is there some way to let the StreamWriter append to an existing file?
StreamWriter
. Ausing
block is better syntax for this. – Bharatusing (var stream = new StreamWriter(..)) { stream.WriteLine(..); }
– Bharat