using System; using System.Configuration; using System.IO; namespace ToIO { class Program { static void Main(string[] args) { for (int i = 0; i < 10; i++) { WriteLog("Index=" + i); } } public static void WriteLog(string logMessage) { using (StreamWriter w = File.AppendText(@"E:\log.txt")) { w.WriteLine("'{0}',", logMessage); w.Flush(); } } } }