Skip to content
| Marketplace
Sign in
Visual Studio>Tools>Move Class To File
Move Class To File

Move Class To File

Filip W

|
9,251 installs
| (11) | Free
Roslyn refactoring allowing you to extract a class to a separate file.
Download

A Roslyn-based refactoring (Ctrl + .) which allows you to extract a class into its own file.

Class is extracted into the same folder that the current file is located in. The namespace is the same is of the original file; similarly all of the using statements are copied over. If the class has any comments on it, they are taken as well.

Obviously, it's also removed from the original document.

The refactoring is offered only for classes matching the following requirements:

  • class is not private
  • class name does not match the current filename

Additionally, the extension suggest to change the name of the file to match the name of the type if there is only one class left in the .cs file, and if the name of the file doesn't match the name of the class.

Note: Versions 0.4.0+ addresses formatting problems.

For discussions, bug reports and PRs, please visit the repo at https://github.com/filipw/Strathweb.Roslyn

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft