Simple Write File using C#

A very simple method for writing to a file, not forget to include using System.IO;.

string filename = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\test.txt";
string content = "This is the new file content";
File.WriteAllText(filename, content);

Leave a Reply