Posts Tagged ‘Usings’

Refactoring using statements with CodeRush/Refactor!

May 9th, 2012 Comments off

As many of you know, the using statement is a good tool for managing types which will be accessing unmanaged resources. The using statement provides a simple and convenient syntax that ensures that objects that implement the IDisposable interface are correctly disposed.

If the object is not disposed, CodeRush highlights the undisposed variables with the “Undisposed local” code issue:

Read more…

Code Issues – Redundant namespace reference

June 30th, 2011 Comments off


The Redundant namespace reference code issue highlights unused namespace references that can be safely removed in gray (dead code issue), which may improve readability.

Read more…

Code Templates – Using/Imports directives

May 11th, 2011 Comments off

Here is the list of CodeRush using (C#)/Imports (VB) specific code templates. The templates below generate namespace reference declarations. Templates start with the letter “u” (the equivalent templates start with the letter “i” in VB). To add a namespace, just enter a “u” followed by the uppercase letters of the namespace. For example, to add a reference to “System.IO”, use “usio”.

These templates can be found on the Editor | Templates options page in the Options Dialog. Expansions containing several values in parenthesis will be enumerated using the CodeRush Intellassist feature: pressing the Tab/Shift+Tab keys will switch to another value.

Read more…