【发布时间】:2011-09-20 16:02:25
【问题描述】:
可能重复:
Can any one tell why the previous data is still displayed while saving data using StreamWriter
我有 WPF C# 应用程序,它读取和写入 .txt 文件,我知道如何写行,但我知道如何覆盖已经是文件的文本。这就是我要写入文本文件下一行的内容,但我想越过这些行而不仅仅是写入下一行,谢谢。
using (StreamWriter newTask = new StreamWriter("test.txt", true))
{
newTask.WriteLine(name[i].ToString());
}
【问题讨论】:
-
您要覆盖整个文件,还是只覆盖顶部的行?
标签: c# text streamwriter overwrite