RAD Studio (Common)
Refactoring: Extracting Method
To extract a method:
In the Editor, open the class or interface containing the code fragment that you wish to extract.
Place the mouse cursor in the desired fragment of source code. Refactoring determines the beginning and the end of the relevant statement.
On the main menu, choose
Alternatively, right-click the code fragment and choose Refactoring->Extract Method
on the context menu.
In the dialog box that opens, specify the following information:
Name of the new method
Visibility (public, protected, private, internal, internal protected)
Whether the method is Static.
to complete the extraction and create the new method.
When applying Extract Method, parameters and local variables in the selected code fragment become the parameters of the new method.
The code fragment cannot contain a return statement of the original method. An error message displays if you attempt to include a return statement in the code fragment.
The code fragment cannot modify more than one single local variable. An error message displays if you violate this restriction.
If the selected code fragment is repeated in several locations, it is your responsibility to replace these fragments in the appropriate locations with the proper method calls.
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic?