ReSharper 2017.3 Help

Move Type to Another Namespace refactoring

ReSharper | Refactor | Move…
F6
ReSharper_Move

This refactoring helps you move one or more non-nested types to a new or an existing namespace. Namespace declarations are replaced right in the original files and all usages are updated accordingly.

If you need to move a nested type, you can first apply the Move Type to Outer Scope refactoring.

To move one or more types to another namespace

  1. Select types that you want to move in one of the following ways:
    • In the editor, set the caret at the name of a type.
    • Select one or several types and/or files and/or folders in the Solution Explorer.
    • Select one or several types in the File Structure window.
    • Select a type in the Class View.
    • Select a type in the Object Browser.
    • Select a type or folder(s) in the type dependency diagram.
  2. Do one of the following:
    • Press F6 and then choose Move Type to Another Namespace
    • Press Ctrl+Shift+R and then choose Move Type to Another Namespace
    • Right-click and choose Refactor | Move Type to Another Namespace in the context menu.
    • Choose ReSharper | Refactor | Move… in the main menu.
    The Move Type to Another Namespace dialog will open.
  3. Start typing the name of the target namespace. If you are moving type(s) to an existing namespace, pick it from the drop down list that displays all namespaces matching your input.
  4. To apply the refactoring, click Next.
  5. If no conflicts are found, ReSharper performs the refactoring immediately. Otherwise, it prompts you to resolve conflicts.
ReSharper. 'Move to another namespace' refactoring

This feature is supported in the following languages and technologies:

Language: C# Language: VB.NET Language: C++ Language: HTML Language: ASP.NET Language: Razor Language: JavaScript Language: TypeScript Language: CSS Language: XML Language: XAML Language: Resx Language: Build Scripts Language: Protobuf Language: JSON
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

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

Last modified: 7 December 2017

See Also

Procedures: