Move File to Folder
Purpose
Moves a file to a folder that corresponds to the current namespace.
Availability
Available when the caret is in a namespace declaration or file-scoped namespace declaration. The file must be located in a folder whose name is different from the namespace name.
Usage
Place the caret in a namespace declaration or file-scoped namespace declaration (for C# 10):
Press Ctrl + . or Ctrl + ~ to invoke the Code Actions menu.
Select Move File to Folder: {Folder Name} from the menu.
After execution, this refactoring moves a file to a folder that matches the selected namespace. If the target folder does not exist in the solution, this refactoring creates this folder.
The following screencast shows the “Move Type to Folder” refactoring in action for C#:
See Also