Introduce Method Dialog Box
See Also
Use this dialog box to specify options for the Introduce Method refactoring command.
You can use the Introduce Method command to create a new method from
selected code in the IDE. When you
use this operation, a method is created and selected code
is replaced with a call to the new method.
You can open the Introduce Method dialog box by selecting the block of code that you
want to have extracted into a method, pressing Alt-Enter, and then choosing Introduce Method.
The dialog box has the following fields:
- Method Name. Contains the name of the method
to be created.
- Access. Drop-down list containing the four
possible accessibility modifiers (public, protected,
<default>, and private). Select the accessibility
modifier that you want the method to have.
- Parameters. Displays the parameters for the method.
You can use the Move Up and Move Down buttons to change the order of the
parameters.
- Method Signature Preview. Shows the way that the method
signature will look based on the values of the other fields in the
dialog box.
If you want to preview the changes, you need to follow these steps
to complete the refactoring:
- Click Preview.
The Refactoring
window opens and displays a tree view of the code to be affected by the refactoring.
- Check the items displayed in the Refactoring window to make sure that you want them
all changed. Clear the checkbox next to any parts of the code that
you do not want changed.
- Click Do Refactoring.
- You should always perform a clean build after completing
any refactoring commands. You can do a clean build by right-clicking the project's
node in the Projects window and choosing Clean and Build Project.
- See Also
- About Refactoring
- Refactoring: Quick Reference
- Undoing Refactoring Changes
Legal Notices