.Net初学者课程:如何在文件中添加文本
如何在一个文件中添加文本的一行代码?
File.AppendAllText(@"c:\path\file.txt", "text content" + Environment.NewLine);
好了!不需要在 C# 中打开 StreamWriter 和其他所有内容,这只需一行代码即可完成。
查看微软文档:https://docs.microsoft.com/fr-fr/dotnet/api/system.io.file.appendalltext
Join the conversation
You need an account to comment on this article. Creating one is free and takes under a minute.
No comments yet.