Rename
What: Rename identifiers for code symbols such as fields, local variables, methods, namespaces, properties and types.
When: You want to safely rename something without having to find all instances, and copy/paste the new name.
Why: Copy and pasting the new name across an entire project could result in errors. This feature accurately performs the rename.
How:
Highlight or place the text cursor inside the item to be renamed:
Next, do one of the following:
- Keyboard
- Press Ctrl+R, then Ctrl+R. (Your keyboard shortcut may be different depending on which profile you've selected.)
- Mouse
- Select Edit > Refactor > Rename.
- Right-click the code and select Rename.
- Keyboard
In the Rename window that pops up, enter the new name for the selected item and click the Preview button. Change the Search scope if you need to widen or narrow the scope of the renaming.
Tip
You can skip the preview by checking the Skip preview changes if references are all confirmed option.
When the Preview Changes - Rename window appears, ensure that the changes you're requesting are being made appropriately. Use the checkboxes in the top half of the window to enable or disable the renaming of any item.
When everything looks good, click the Apply button, and the item will be renamed in your source code.