无法访问一个MemoryStream的封闭流,如何重新打开? [英] Cannot access a closed Stream of a memoryStream, how to reopen?
本文介绍了无法访问一个MemoryStream的封闭流,如何重新打开?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个MemoryStream实例,它是封闭的。
我已经尝试过:
memoryStream.Flush();
memoryStream.Position = 0;
重新内存流,但它不工作。我怎样才能重新打开关闭的内存流?
先谢谢了。
解决方案
我怎样才能重新打开关闭的内存流?
块引用>
您不能重新打开该流。如果你需要重置流,只是为它分配一个新的实例:
MemoryStream的=新的MemoryStream();
I have a memoryStream instance and it is closed.
I already have tried:
memoryStream.Flush(); memoryStream.Position=0;
to reopen the memory stream but it does not work. How can I reopen a closed memory stream?
thanks in advance.
解决方案How can I reopen a closed memory stream?
You can't reopen the stream. If you need to "reset" the stream, just assign it a new instance:
memoryStream = new MemoryStream();
这篇关于无法访问一个MemoryStream的封闭流,如何重新打开?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文