大家好,我想请教个问题哈,如果以字符串的形式向 StreamWriter 写出数据,是不是在执行 sw.Write() 的时候先把数据放在缓存中,在执行 sw.Close() 的时候再一起写入文件中?我现在要边做一个实验边向一个文件中写实验结果,随着时间的累积,数据量可能会比较大,大概两三百M吧,如果一直放在缓存中,直到最后才用 sw.Close()写进文件,会不会导致程序不响应?谢谢大家了····
调试欢乐多
using (StreamWriter sw = new StreamWriter("TestFile.txt"))
{
sw.Write("This is the"); sw.WriteLine("header for the file");
sw.WriteLine("--------------------"); sw.WriteLine("THE date is:");
sw.WriteLine(DateTime.Now);
}