【发布时间】:2025-12-17 12:10:02
【问题描述】:
我在尝试将我的流分配给另一个流并将其处理如下时遇到了一个异常
Stream str = new FileStream(somefile, FileMode.OpenOrCreate);
Stream newstr = str;
str.Dispose(); // I disposed only str and not new str
byte[] b = new byte[newstr.Length];// got exception here stating unable to access closed stream...
为什么……?我是 C# 和 Stream 的新手,其中 Stream 在命名空间 System.IO 中。
【问题讨论】: