How can I extract all classes into separate file?
I'm using the Resharper trial and VS2008. Is it possible to extract all classes from one file into a separate file? I'm able to do this using Resharper but it only seems to work for individual classes. This is to be used on a file that was auto-generated that is 65,000 lin开发者_开发知识库es long.
If you're using ReSharper 5, on the solution explorer, press Ctrl+Shift+R to invoke the Refactor menu (or alternatively right-click and locate it) and select "Move Types into Matching Files"
For those that are running a newer version of Visual Studio, there is yet another solution (I realize the question mentions VS 2008). Visual Studio 2017 offers functionality similar to what Eduardo Molteni described for CodeRush. You simply click on a class name, click on the light bulb icon to the left, and select "Move type to xxxx.cs".
In addition to Scott's solution, there's a free refactoring tool in Visual Studio Marketplace called Move Type to File.
It can bulk move types to their own separate files, like so:
It also provides a quick shortcut to move a type highlighted by the cursor (default Ctrl + Shift + F1).
Saved me a LOT of manual work...
精彩评论