How to write to a text file in C#?

using System;
using System.IO;

class TexFileSample
{
public static void Main()
{

using (StreamWriter sw = new StreamWriter(@"C:\SomeTextFile.txt"))
{
sw.Write("Writing Text ");
sw.WriteLine("Here we go.");
sw.WriteLine("-------------------");
sw.Write("Today is is: " + DateTime.Now);
sw.WriteLine("Done");
}
}
}