净MemoryStream的接近问题 [英] .Net MemoryStream close issue

查看:125
本文介绍了净MemoryStream的接近问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于一个净的MemoryStream对象实例,我需要使用它后,明确地关闭它?或者没有必要关闭它?这是最好的做法是什么?

For a .Net MemoryStream object instance, do I need to close it explicitly after using it? Or no need to close it? Which is the best practices?

我使用VSTS2008 +净3.5 + C#。

I am using VSTS2008 + .Net 3.5 + C#.

在此先感谢, 乔治

推荐答案

您应该关闭它,当你用它做。最好的做法是在一个try-catch-finally块的最后部分关闭流。你可以在这里得到更多的信息:

you should close it when you are done with it. The best practice is to close the stream in the finally section of a try-catch-finally block. you can get more information here:

http://msdn.microsoft.com/en-美国/库/ system.io.memorystream.aspx

这篇关于净MemoryStream的接近问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆