Write to Text File.
//Use the using directive
using System.IO;
//Write to Text File.
private void WriteToTextFile(string filePath){
StreamWriter tw = new StreamWriter(filePath);
try{
tw.Write(fileContent);
}
finally{
tw.Close();
}
}