ReSharper 2025.2 Help

Move Type to Outer Scope refactoring

This refactoring helps you move a nested type one level up. All corresponding references are automatically updated, even if the nested type uses members of the parent type.

Move a type to outer scope

  1. Select a nested type in one of the following ways:

    • In the editor, place the caret at the name of a nested type.

    • Select a nested type in the Solution Explorer.

    • Select a nested type in the File Structure window window.

    • Select a nested type in the Class View.

    • Select a nested type in the Object Browser.

    • Select a nested type in the type dependency diagram.

  2. Do one of the following:

    • Press F6 and then choose Move to Outer Scope

    • Press Control+Shift+R and then choose Move to Outer Scope.

    • Right-click and choose Refactor | Move to Outer Scope from the context menu.

    • Choose ReSharper | Refactor | Move… from the main menu.

    The Move to Outer Scope dialog will open.

  3. Optionally, you can specify a different name for the type.

  4. Select the Search in comments checkbox to update references to the type in comments.

  5. To apply the refactoring, click Next.

  6. If no conflicts are found, ReSharper performs the refactoring immediately. Otherwise, it prompts you to resolve conflicts.

ReSharper: refactorings: Move type to outer scope

This feature is supported in the following languages and technologies:

Language: C#

Language: VB.NET

Language: C++

Language: ASP.NET

Language: Razor

Language: XAML

Language: Resx

Language: Build Scripts

Language: SQL

Feature is available in C#

Feature is available in Visual Basic

Feature is not available in C++

Feature is not available in ASP.NET

Feature is not available in Razor

Feature is not available in XAML

Feature is not available in Resource files

Feature is not available in build script files

Feature is not available in SQL/NoSQL files and injections

The instructions and examples given here address the use of the feature in C#. For more information about other languages, refer to corresponding topics in the Languages and frameworks section.

23 September 2024