您的位置:首页 > 其它

Item 15:Utilize using and try/finally for Resource Cleanup

2005-08-12 19:59 459 查看
Types that use unmanaged system resource should be explicity released using the dispose() method of the IDisposable interface.
这个Item只是建议多使用using和try...catch块。值得注意的是using语句本身也是将代码生成为try...catch块。他们产生的IL是一样的。还有就是using 语句中的变量要是支持IDispose接口的,否则会报错!!不要重递使用using
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: