c# 控制台输出txt文件

string tempFileName = "DETAIL_" + DateTime.Now.ToString("yyyyMMddHHmmssffff") + ".txt";
string tempFilePath = Environment.CurrentDirectory + "\\" + tempFileName;
var output = new StreamWriter(tempFilePath, false, Encoding.UTF8);
output.WriteLine(string.Format("{0},{1}", item.Name, item.UserName));
output.Flush();
output.Close();
output.Dispose();
Console.WriteLine("====全部生成完毕====");
Console.ReadLine();

 

posted @ 2017-07-10 16:10  幸福安康  阅读(2572)  评论(0编辑  收藏  举报