Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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)

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

like image 389
Greg Avatar asked Oct 15 '22 10:10

Greg


2 Answers

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.

like image 129
Mark Rushakoff Avatar answered Oct 19 '22 01:10

Mark Rushakoff


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.

like image 30
Fernando Avatar answered Oct 19 '22 01:10

Fernando