Append To File
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Collections.Specialized;
using System.Diagnostics;
public static class FileUtils
{
public static void AppendToFile(string fileName, string line)
{
try
{
using (StreamWriter sw = File.AppendText(fileName))
{
sw.WriteLine(line);
}
}
catch (Exception ex)
{
Trace.TraceError("File I/O Error: {0}, StackTrace: {1}", ex.Message, ex.StackTrace);
}
}
}
Related examples in the same category