C# 字符串写入文件

 

会覆盖已存在文件
File.WriteAllText(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "abv.json"), "创建连接字符串开始");

true不会覆盖已存在文件
StreamWriter sw = new StreamWriter(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "abv.json"), true);
sw.Write("创建连接字符串结束");
sw.Close();

 

posted @ 2019-09-28 16:32  剑存古风  阅读(2787)  评论(0编辑  收藏  举报