CodeRush Xpress

Refactorings for Moving and Extracting Methods

Extract Method

Creates a new method from the selected code block. The selection is replaced with appropriate calling code to invoke the newly-declared method.

In C# control is passed to the built-in refactoring that extracts methods. In Visual Basic CodeRush Xpress implements this refactoring.

Refactoring - Extract Method

Extract Method to Type

Creates a new method from the selected code block and moves it to the specified type, updating the selected code block appropriately. The selection is replaced with suitable calling code to invoke the newly-declared method through an instance of the target type. This refactoring is useful when you have a block of code that references several properties or methods on a variable of a type that is declared elsewhere in your solution.

Refactoring - Extract Method to Type

After extracting the code block above, the new method looks like this:

Refactoring - Extract Method to Type

And the calling site looks like this:

Refactoring - Extract Method to Type

Extract Property

Creates a new property from the selected code block. The selection is replaced with appropriate code to reference the newly-declared property.

Refactoring - Extract Property

After extraction the property name is selected and linked up for an easy rename.

Refactoring - Extract Property

Replace Temp with Query

Replaces each reference to this local variable with a call to an extracted method, which returns the initial value assigned to this local.

Refactoring - Replace Temp with Query

More from DevExpress
Live Chat
Have a pre-sales question?
Need assistance with your evaluation?
We are here to help.
Chat is one of the many ways you can contact members of the DevExpress Team. We are available Monday-Friday between 7:30am and 4:30pm Pacific Time.
If you need additional product information, require pre-sales assistance, or want help with your order, write to us at info@devexpress.com or call us at
+1 (818) 844-3383.