Recognize Disposable Objects in Visual Studio?

If you want to highlight disposable objects differently in VS please check out this post. I personally prefer Resharper answer as I always use R#.

If you just want to figure out if your object is an instance of some interface you can right-button-click on the variable name and Navigate -> Object Browser or Go to Declaration and then right-button-click on class name Go to Definition/Peek Definition.

enter image description here

You might like Peek Definition as it shows everything you need inline:

enter image description here

You can always check what methods object has, if it has Dispose() method then 99.9% it’s a disposable object. I’ll give this 0.01% for those who give methods bad names :).

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)