信息写入记事本方法

/// <summary>
/// 信息写入记事本
/// </summary>
/// <param name="text"></param>
/// <param name="path"></param>
public static void Write(string text, string path)
{
try
{
DateTime newDate = DateTime.Now;
string msg = newDate.ToLongTimeString() + ":" + text;
StreamWriter sw = File.AppendText(path);
sw.WriteLine(msg);
sw.Flush();
sw.Close();

}
catch (Exception ex)
{
throw ex;
}
}

原文地址:https://www.cnblogs.com/ChineseMoonGod/p/3729842.html