先展示语法结构给大家:
System.IO.File.WriteAllText(Path, str);
下面时一个简单的写入程序,可以在计算机目录中找到
string Path = @"D:\写入日志.txt";//写入日志
string str = "2020-5-5\t11:20 [写入日志完成]";//保存的内容
System.IO.File.WriteAllText(Path, str);
Console.WriteLine("写入日志成功");
实现功能:在text中写入日志,写入日期