ReSharper Web Help

The Move to Another File refactoring helps you move the chosen type from the current file to any other file. All necessary directives are moved with the type. All using directives that are no longer necessary are removed from the original file.

To move a type to another file
  1. Place the caret at the name of a class or interface, etc. 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.
    The Move drop-down list is displayed.
  3. In the Move drop-down list, click Move to Another File. The Move to Another File dialog box opens:

    Refactorings__Move__Type_to_Another_File

  4. Type a file name in the New file name text box. You can specify the name for an existing file or a new one. In the latter case, the new file is created in the current folder.
  5. Click Next. If no conflicts are found, ReSharper performs the refactoring immediately. Otherwise, resolve conflicts.

Tip

When you undo this action, be aware that content is deleted from the newly created file, however the file itself is preserved in project.

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

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: