Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to move private fields to the top of the class with ReSharper

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?

like image 391
pencilCake Avatar asked Mar 01 '23 10:03

pencilCake


1 Answers

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.

like image 118
Drew Noakes Avatar answered Apr 28 '23 21:04

Drew Noakes