Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
可能重复: FileStream Append Data 在顶部
我有一个以写权限打开的文件流。我正在尝试从流中“删除”数据,但我不知道如何。我需要一个解决方案,例如更改流的 Length 属性。有人有蚂蚁的想法吗?
我想你正在寻找Stream.SetLength.
Stream.SetLength
如果指定的值小于流的当前长度,则截断流。