Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想使用 StreamWriter 写入我项目的调试文件夹中已经存在的文件。我怎样才能做到这一点?我认为 StreamWriter 只能写入一个全新的文件。
你的意思是追加?
StreamWriter sw = new StreamWriter("abc.txt", true); sw.WriteLine("test"); sw.Close();
using(var sw = new StreamWriter("yourfile.txt", true))//default location is your bin folder { }
使用上述重载