Rename

In this article

What: Lets you 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 would likely result in errors. This refactoring tool will accurately perform the renaming action.

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. (Note that your keyboard shortcut may be different based on which profile you've selected.)

Mouse

Select Edit > Refactor > Rename.

Right-click the code and select Rename.

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 are 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.

Note

The feedback system for this content will be changing soon. Old comments will not be carried over. If content within a comment thread is important to you, please save a copy. For more information on the upcoming change, we invite you to read our blog post.