Move type to namespace

Applies to: yesVisual Studio noVisual Studio for Mac noVisual Studio Code

This refactoring applies to:

  • C#

What: Move type to namespace.

When: You want to move a type to a different namespace or folder.

Why: You want to refactor parts of your solution and have a quick way to move a type to a different namespace or folder.

How-to

  1. Place your cursor in the class name.

  2. Press Ctrl+. to trigger the Quick Actions and Refactorings menu.

  3. Select Move to namespace.

    Move to namespace refactoring

  4. In the dialog box that opens, select the target namespace you'd like to move the type to.

    Select a namespace dialog box

See also