views:

68

answers:

3

I want to move all the private fields in a class to the top or at least to a block where they are gathered together.

Is there any quick way to achieve this with ReSharper?

A: 

Have you tried the Clean code options?

I believe you can set the behaviour there.

Kindness,

Dan

Daniel Elliott
+1  A: 

I answered a similar question here. It's for putting them at the bottom, but should be enough information to get you set up too.

Martin Harris
+3  A: 

You want the feature called Cleanup Code.

You can access it via

  • CTRL+ALT+F, according to my keyboard shortcuts, or
  • the window menu Resharper | Code | Cleanup code...

Ensure that your profile has the option Reorder members selected. If you want to change the way that the reordering works, you can, but it's a little involved.

You can also apply this across an entire project or the entire solution by right-clicking at the appropriate level in solution explorer and choosing the Cleanup Code... option from there.

Drew Noakes
If you are using the Visual Studio Resharper keyboard scheme then the keyboard shortcut you want is Ctrl+E, C or Ctrl+E, K for silent mode. (According to the cheat sheet I have in front of me)
Martin Harris
Thanks! This This really does what I need!
burak ozdogan
Cool. Glad to help.
Drew Noakes

related questions