Write 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 WriteToFile(string fileName, string line)
{
try
{
using (StreamWriter sw = File.CreateText(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