C# Write to File

Writing to a file is relatively easy in C#.

///<summary>
///Write an entry to our logfile</summary>
///<param name="message">The message you want to write to the log file</param>
private voidlog(string message)
{
StreamWriter writer = newStreamWriter(@"c:\log.txt", true);
writer.WriteLine(formatEntry(message));
writer.Flush();
writer.Close();
}

Simple.

Comments are closed.