22

I've started to refactor/clean up big project. Some of files contains few small classes or few enums (yeah, it is very messy;/ ).
Is there some method or tool to automatically divide files with few enums/classes and create separate files for each of them?

As Fredrik Mörk said - Resharper is very good tool and has possibility to do what I need. But of course as almost all good tools it costs (for one it is cheap, for another not:) ).

Maybe there is some free tool for such simple refactoring? (my boss will not pay for Resharper - he told me that I need 'hammer' not a whole workshop:) )

Marek Kwiendacz
  • 9,524
  • 14
  • 48
  • 72

2 Answers2

23

Resharper has a refactoring that moves a type to a separate file. Might be that it can be applied on a higher level (as project); don't have it installed on this machine to verify though.

Edit: noticed in the online help that there is a refactoring called Move Types Into Matching Files that does exactly what you are asking for.

Fredrik Mörk
  • 155,851
  • 29
  • 291
  • 343
5

CodeRush xpress (free) also supports Moving a type into a matching file

enter image description here

Eduardo Molteni
  • 38,786
  • 23
  • 141
  • 206