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. 
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. 
After extracting the code block above, the new method looks like this: 
And the calling site looks like this: 
Extract Property
Creates a new property from the selected code block. The selection is replaced with appropriate code to reference the newly-declared property. 
After extraction the property name is selected and linked up for an easy rename. 
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. 
|