using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"d:\test\ErrorLog.txt", true)) { file.WriteLine(System.DateTime.Now+":"); file.WriteLine("信息!"); file.Dispose(); }