ReSharper Web Help

ReSharper traditionally provides an extended set of automated code refactorings that allow you to rename, move, and safely delete symbols; introduce and inline fields, variables, or parameters, and carry out many more improvements.

Note

Visual Studio provides its own Refactor menu that is available from both main and context menus. By default, ReSharper hides the native Visual Studio menu. To make it accessible, choose ReSharper | Options, open the Environment | Keyboard & Menus tab, and select the Hide overridden Visual Studio menu items check box.

To perform a refactoring
  1. Select an object or a code fragment that you want to refactor.
  2. To select a refactoring, do one of the following:
    • On the main menu, choose ReSharper | Refactor, and select a refactoring from the submenu.
    • In the File Structure window, right-click the desired node, choose Refactor from the context menu, and select the required refactoring from the submenu.  
    • On the main menu, choose  ReSharper | Refactor | Refactor This, or press Ctrl+Shift+R to display the list of applicable refactorings, and select one of them. You can also execute this action through the context menu of a selection.
    • Click the refactor icon Coding_Assistance__Context_Actions__icon_refactor to the left of a code line to display the list of context actions that act as shortcuts to contextually applicable refactorings.
    • Use keyboard shortcuts assigned to refactorings.
    The refactoring wizard opens. Except for the first step, the wizard's dialog boxes are not modal, so you can edit the code while the wizard is open.
  3. To roll back refactoring actions, the wizard provides the option To enable Undo, open all files with changes for editing. If you select this option, ReSharper opens the modified files in new editor tabs and enables you to roll the refactoring back. In this case, you will need to save the changes yourself. If this option is not selected, ReSharper saves modified files automatically, without opening them.
  4. If a refactoring operation causes code conflicts (such as duplicate names, visibility conflicts, etc.), the wizard displays the list of conflicts on the last step. For some conflicts, the wizard can also suggest quick-fixes. For more information, see Resolving Conflicts in Refactorings.