Do I need to use FileStream.Flush() or FileStream.Flush(true)?

前端 未结 2 1084
长发绾君心
长发绾君心 2021-01-28 08:17

In my program, I write a file, then call an external program that reads that file. Do I need Flush(true) to make sure that the data is written entirely to disk, or is Flush() su

2条回答
  •  情书的邮戳
    2021-01-28 08:33

    Neither; you should simply dispose the stream in a using statement.

    Or, better yet, replace the whole thing with File.AppendAllText().

提交回复
热议问题