Moves a type declaration to a new source code file. The best coding practices require each type to be declared in a separate file. Use this Refactoring to easily isolate a type in a separate source file.
Available when the caret is on a type declaration and the file contains two or more types. The type should have a name that differs from the file name.
Place the caret on a class declaration.
The blinking cursor shows the caret's position at which the Refactoring is available.
Use the Ctrl + . or Ctrl + ~ shortcut to invoke the Code Actions Menu.
Select Move Type to File from the menu.
After execution, the Refactoring creates a new source file named after the type, adds it to the project and moves the type to that file. All leading comments, attributes, and XML doc comments are moved to the new file together with the type itself. All references used by the type are added to the new file automatically.