提问人:SpiritBob 提问时间:9/10/2021 更新时间:9/10/2021 访问量:189
如果需要在从同一流写入 FileStream 后读取其数据,是否需要调用 Flush 到 FileStream?
Do you need to call Flush to a FileStream if you need to read its data after writing to it from the same stream?
问:
using Stream someOtherData = GetMeSomeData();
using FileStream fs = File.Create("Hello-world!");
someOtherData.CopyTo(fs);
fs.Flush(); // Is this needed?
fs.Position = 0;
ReadDataInStream(fs); // Reads the data in the stream by using Stream.Read().
答: 暂无答案
评论
someOtherData
fs
ReadDataInStream(fs)
StreamReader.DiscardBufferedData()
StreamReader
FileStream
Position