My current favorite refactoring is “Move Type to File”. The C# best practice is to have only one class per .cs file but sometimes you’re in the coding groove and you just want to quickly create the class and keep going. Having to go to Solution Explorer just slows you down. You could put two classes in the same file like I’ve got in the “DemoClass1.cs” screenshot but you have to remember to move that class to it’s own file later. Before “Move Type to File” it was kind of a hassle to manually move the code.
“Move Type to File” takes the current class, creates a new file in your project and moves the namespace, the code, and any relevant using statements. It’s super slick and I’ve been using it a ton lately.
Here’s the process:
1. Put the cursor anywhere on the class definition line
2. Click CTRL-` to bring up the Refactor Pro menu
3. Choose “Move Type to File” and you’re done
There are also a lot of hidden “beta” refactorings available in the current version of the Refactor Pro product (I’m running 2.5.8 right now).
Here’s how you can turn on the “hidden” refactorings:
1. From the Visual Studio main menu, choose DevExpress –> Options…
2. Expand the Editor folder
3. Expand the Refactoring folder
4. Select Early Experience
5. Check “Enable early experience (beta) refactorings”
6. Click the OK button to save your configuration changes