c# - 如果您需要在从同一流写入数据后读取它的数据,是否需要将 Flush 调用到 FileStream?
问题描述
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().
解决方案
推荐阅读
- java - Maven 不解析父 pom.xml 文件中的属性
- postgresql - 如何在弹性beantalk中将PostgreSQL RDS连接到spring boot?
- scala - 在 databrick 笔记本上的多个集群上运行时,Spark 作业不打印
- android - 删除没有id的通知通道
- numpy - 如何通过一维矩阵中的给定值自动生成矩阵
- c# - 如何在 .Net Blazor 中获取 Javascript 回调?
- python - 如何访问在数据框中保存为对象的分类数据?
- python - Python Paramiko SFTP 打开文件从 N 行开始
- typescript - 使用 typescript 将组件传递给 apolloprovider
- oracle - (Oracle)如何在不创建另一个表的情况下方便地测试用户功能