10

CodeRush has this nifty plugin called cr_ClassCleaner that allows me to sort the elements in the class (e.g. methods, private variables, etc...).

Can Resharper 5.x do this, either via the product or plugins?

AngryHacker
  • 59,598
  • 102
  • 325
  • 594

3 Answers3

11

Yes - ReSharper, Tools, Cleanup Code.

They recently blogged about customising the type layout this generates.

Rup
  • 33,765
  • 9
  • 83
  • 112
4

There is an option in code cleanup to reorder type members. This would be done as part of a full cleanup. If you wanted to only reorder, you could create a cleanup profile that only included that step. You can have multiple cleanup profile.

Tim Hoolihan
  • 12,316
  • 3
  • 41
  • 54
3

Ctrl+Alt+F (if you're using the IDEA profile) will take you to the cleanup code menu where you can achieve that.

Doron Yaacoby
  • 9,412
  • 8
  • 48
  • 59
  • I am looking at the Cleanup Code dialog, there is an option to reorder code elements. If I proceed with it, it does not sort the methods. – AngryHacker Feb 16 '11 at 18:31
  • I don't think it reorders the contents of each group by default, no. But you can configure it to - see [Sorting, Grouping and Regions](http://blogs.jetbrains.com/dotnet/2011/01/in-depth-look-at-customizing-type-layout-with-resharper/) at the bottom of this blog post. – Rup Feb 17 '11 at 00:05