开发者

c# question - is there a tool to identify where I should/can use a "using" statement to ensure resources are closed?

开发者 https://www.devze.com 2022-12-18 15:11 出处:网络
c# question - is there a tool to identify where I should/can use a \"using\" statement to ensure resources are closed? (to avoid memory leaks etc开发者_C百科)

c# question - is there a tool to identify where I should/can use a "using" statement to ensure resources are closed? (to avoid memory leaks etc开发者_C百科)

Including both the cases that:

a) there are resources not been closed and

b) syntax is using a try-catch-finally and identies this could be changed to a using

Thanks


I'm not sure if it covers case b explicitly, but Gendarme is a fine tool that will tell you when you don't have a using statement around disposable objects.


Don't know if this is the kind of tool that you're looking for, but Code Rush will highlight your code when you have an object from a class that implements IDisposable and you're not diposing it.


Take a look if you can to enable code analysis in your project and turn on Microsoft.Reliability: Dispose objects before losing scope rule


FxCop is a free tool from Microsoft that can do this. It's also included in the "Team System" variants of Visual Studio 2005+

0

精彩评论

暂无评论...
验证码 换一张
取 消