var dir = Environment.CurrentDirectory + "\\Logs"; if (Directory.Exists(dir)) { Directory.CreateDirectory(dir); } var logName = string.Concat(dir, DateTime.Now.ToString(".yyyyMMdd"), ".log"); if (!File.Exists(logName)) { File.Create(logName).Close(); } var guidS = Guid.NewGuid().ToString(); var guidSReplace = guidS.Replace("-", string.Empty); File.WriteAllText(logName, string.Concat(guidS.Length.ToString(), "-", guidSReplace.Length.ToString(), "-", guidS));
标签:文件,string,C#,guidS,logName,var,ToString,快速,dir From: https://www.cnblogs.com/hofmann/p/17495509.html