I would like to create a .txt file and write to it, and if the file already exists I just want to append some more lines:
string path = @\"E:\\AppServ\\Examp
string path=@"E:\AppServ\Example.txt"; if(!File.Exists(path)) { File.Create(path).Dispose(); using( TextWriter tw = new StreamWriter(path)) { tw.WriteLine("The very first line!"); } } else if (File.Exists(path)) { using(TextWriter tw = new StreamWriter(path)) { tw.WriteLine("The next line!"); } }