ReSharper 8.0 Web Help

The Move to Another Type refactoring helps you move inner classes, static fields and methods to another type. All corresponding references and usages are automatically updated, including scenarios where a member uses other members of its original type.

Tip

To move a non-static method, perform the following sequence of refactorings: Make method static, then Move a type to another type, then Make method non-static.
To move a static member or an inner type to another type
  1. Place the caret at the name of a static member or an inner type in the editor or select it in the Class View window or in the Object Browser window.
  2. Do one of the following:
    • On the main menu, choose ReSharper | Refactor | Move.
    • Choose Refactor | Move on the context menu.
    • Press F6Ctrl+R,O.
  3. If an inner type is selected, the Move drop-down list appears, click Move to Another Type and the Move to Another Type dialog box opens. Otherwise, this dialog box opens immediately.

    Refactorings__Move__Type_to_Another_Type

  4. Type or browse to the name of the target class using the drop-down list.
  5. All static members of the containing class and its inner types are displayed in the text area. Select check boxes next to members or inner types to move them.

    Note

    If the refactored static member uses another static member of the same class, ReSharper highlights the used member in blue and shows a corresponding tooltip.
  6. Specify the appropriate access rights.
  7. Click Next. If no conflicts are found, ReSharper performs the refactoring immediately. Otherwise, resolve conflicts.

This feature is supported in the following languages/technologies:

C# VB.NET HTML ASPX Razor JavaScript TypeScript CSS XML XAML RESX Build Scripts
feature_available feature_available feature_available feature_available

Tip

The instructions and examples given here address the use of the feature in C#. For details specific to other languages, see the corresponding topics in the ReSharper by Language section.

See Also

Procedures: