Archive

Archive for the ‘Code Providers’ Category

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…

Generating the Switch/Select statement for enumeration variables

April 30th, 2012 Comments off

CodeRush with Refactor! Pro provides a code provider that allows you to easily generate a switch (C#) or Select (VB) statement for all elements of the enumeration of the active identifier of the enumeration type. The Create Case Blocks from Enum code provider shows a part of the resulting code before applying it. It is possible to apply the code provider on a local variable or a parameter:

Read more…

Code Providers – Add to Interface

July 29th, 2011 Comments off

The Add to Interface code provider adds the active member declaration to the specified interface that is implemented by the current type. You can choose the target interface via the sub menu inside the Refactor! popup menu:

Read more…

Code Providers – Add Contract

February 7th, 2011 Comments off

Add Contract code provider adds conditions (contracts or guard code) for a validation of the active method parameters. You can choose the preferred contract via the sub-menu of the Add Contract:

Refactor! Add Contract with sub-menu

Read more…