ReSharper 2017.1 Help

Refactorings

ReSharper provides an extensive set of automated solution-wide code refactorings that allow you to rename, move, and safely delete symbols; introduce and inline fields, variables, or parameters, and carry out many more transformations painlessly.

Refactorings are available for most of the supported languages and project items. To learn more about specific refactorings, study the following sections:

To perform a refactoring

  1. Set your caret at a symbol, select a code fragment that you want to refactor, or select an item in a tool window.
  2. Do one of the following:
    • In the main menu, choose ReSharper | Refactor, and then select a desired refactoring. The list of refactorings available in this menu depends on the current context. If ReSharper cannot suggest any refacrotings for the context, the entire menu is disabled.
    • In the editor, File Structure window, or other ReSharper window, right-click the item you want to transform, choose Refactor from the context menu, and then select the required refactoring.  
    • In 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 choose Refactor This in the context menu of a selection.
    • Use default keyboard shortcuts assigned to specific refactorings, or assign custom shortcuts to your favorite refactorings.
  3. If the selected refactoring requires user input, the refactoring wizard opens. Note that the wizard's dialogs are not modal, so you can edit the code while the wizard is open.
    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 all 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 would cause code conflicts (such as duplicate names, visibility conflicts, etc.), the wizard displays the list of conflicts on the last step, before you apply the refactoring. For some conflicts, the wizard can also suggest quick-fixes. For more information, see Resolving Conflicts in Refactorings.

Some refactorings are available immediately after you modify code in the editor. For more information, see Inplace Refactorings

Most of ReSharper's refactorings are available in C# and Visual Basic.NET, some are available in several languages, others are language-specific. The table below lists all refactorings and languages/technologies where they are supported.

The instructions and examples given in the topics within this section address the use of refactorings in C#. For more information on refactorings available for specific languages, see the corresponding topics in the ReSharper by Language section.

Refactoring C# VB.NET C++ HTML ASPX Razor JavaScript TypeScript CSS XML XAML RESX Build Scripts Protobuf JSON
Refactor This Feature is available Feature is available Feature is available Feature is available Feature is available Feature is available Feature is available Feature is available Feature is available Feature is available Feature is available Feature is available Feature is available Feature is available Feature is not available
Change Signature Feature is available Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Convert Abstract Class to Interface Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Convert Anonymous to Named Type Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Convert Extension Method to Plain Static Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Convert Indexer to Method Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Convert Interface to Abstract Class Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Convert Method to Indexer Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Convert Method to Property Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Convert Property to Auto-Property Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Convert property to method(s) Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Convert Static to Extension Method Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Copy Type Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is available Feature is not available Feature is not available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available
Encapsulate Field Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Extract Class Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available
Extract Interface Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available
Extract Method Feature is available Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Extract Superclass refactoring Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available
Extract CSS Style Feature is not available Feature is not available Feature is not available Feature is available Feature is available Feature is available Feature is not available Feature is not available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Extract XAML Resource Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available
Extract XAML Style Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available
Inline Class Feature is available Feature is available Feature is not available Feature is not available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available
Inline Field Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Inline Method Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Inline Parameter Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Inline Resource Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is available Feature is available Feature is not available Feature is not available Feature is not available
Inline XAML Resource Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available
Inline Variable Feature is available Feature is not available Feature is available Feature is not available Feature is not available Feature is not available Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Introduce Field Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Introduce Namespace Alias Feature is not available Feature is not available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Introduce Parameter Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Introduce Variable Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Introduce Variable for Substring Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Invert Boolean Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Make Method Non-Static Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Make Method/Property Static Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Make Partial Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Move Instance Method Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Move Resource Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is available Feature is available Feature is not available Feature is not available Feature is not available
Move to Resource Feature is available Feature is available Feature is not available Feature is not available Feature is available Feature is available Feature is available Feature is available Feature is not available Feature is not available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available
Move Type to Another File Feature is available Feature is available Feature is not available Feature is available Feature is not available Feature is not available Feature is not available Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Move to Folder Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Move to Another Type Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Move Type to Another Namespace/Module Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is available Feature is not available Feature is not available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available
Move Type to Outer Scope Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Pull Members Up Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Push Members Down Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available
Rename Feature is available Feature is available Feature is available Feature is available Feature is available Feature is available Feature is available Feature is available Feature is available Feature is available Feature is available Feature is available Feature is available Feature is available Feature is not available
Replace Constructor with Factory Method Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Safe Delete Feature is available Feature is available Feature is not available Feature is not available Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is available Feature is available Feature is available Feature is not available Feature is not available
Transform Parameters Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Use Base Type Where Possible Feature is available Feature is available Feature is not available Feature is not available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available

See Also

Last modified: 4 July 2017