The Move Type refactoring allows users to move a given class, struct, delegate, or enum to another namespace or to isolate it in a separate file. All references to the type in code are corrected automatically.
To move an inner type, see description of the Move Type to Outer Scope
and Move Static Member
To move a type
- Select the class, interface, struct, or enum in Class View or Object Browser, or position the caret at its name in the editor.
- Do one of the following:
- On the main menu, click ReSharper | Refactor | Move.
- Right-click the type, and on the shortcut menu click Refactor | Move.
- Press F6.
- Press Ctrl + Shift + R, and then select Move.
The Move Type dialog opens.
- If you want to move the type to another namespace, select the Another namespace option. In this case, using directives and qualified names of the type will be updated.
- In the Namespace text box, type or browse for the destination namespace. In the latter case, you can select the target namespace in the devoted dialog box that displays the namespace hierarchy in the project or solution.
- If you want the find and change the full qualified type name in comments and strings, select the Search in comments and string literals check box.
- Click Continue.
- If you selected the Search in comments and string literals check box, ReSharper displays found usages (if any) in the following dialog box.
- Select the check boxes next to the items you want to rename, and click Continue. Note You can navigate to the locations of the usages and correct them manually. The list of the usages will be updated according to your changes.
- If you want to extract the type to another file, select the Another file option.
- In the File text box, type the file name. You can specify an existing file as well as type a name for a new file. In the latter case, the new file will be created in the current folder.
- Click Continue.
The names and references are updated immediately.