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();