是否有实现IDisposable为using语句通用对象的名单? [英] Is there a list of common object that implement IDisposable for the using statement?

查看:138
本文介绍了是否有实现IDisposable为using语句通用对象的名单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有某种备忘单对哪些对象与using语句顺利... 的SQLConnection 的MemoryStream

I was wondering if there was some sort of cheat sheet for which objects go well with the using statement... SQLConnection, MemoryStream, etc.

把它一步,这将是巨大的,甚至显示其他的拼图,怎么样,你应该实际上的Connection.close()之前调用收盘using语句支架。

Taking it one step further, it would be great to even show the other "pieces of the puzzle", like how you should actually call connection.Close() before the closing using statement bracket.

这样的事情存在吗?如果不是这样,也许我们应该做的。

Anything like that exist? If not, maybe we should make one.

推荐答案

微软的FxCop有一个规则检查您在使用块使用IDisposbale。

Microsoft FxCop has a rule checking that you use an IDisposbale in a using block.

这篇关于是否有实现IDisposable为using语句通用对象的名单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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