The Member Organization feature allows you to automatically organize type members according to specified rules, maintain a unified type structure, and locate the required members.
This feature has predefined settings that you can see in the Editor | All Languages | Organize Members options page.
CodeRush provides two predefined schemes: Default and StyleCop.
The default rule schemes are based on numerous best practices and can be recommended in most cases.
You can configure rules based on the default ones and create new rule schemes. Refer to the Member Organization topic for information on how to configure this feature.
You can insert an empty line above and below all organized members if you enable the corresponding option.
The following screencast shows this feature in action.
Use the "Empty line count between groups" setting to specify how many empty lines should be placed between different code sections. The empty line count default value is 1.
If you want to reduce the empty line count between groups, enable the "Remove existing line breaks" options to remove blank lines between members.
For example, the code below has 2 empty lines between groups. You can use the default "Empty line count between groups" value to change the empty line count to 1.
CodeRush provides an option to skip initialized fields.
In some cases, field initialization order can be important (for example, one field depends on another field). If you change this order in code, it can lead to an exception when a class is created. To avoid this, the "Skip Initialized fields" option is enabled by default. CodeRush does not move initialized fields into the 'fields' group.
To run Organize Members with the default settings, place the caret in a type declaration and select Organize Members from the menu.
The Organize Members feature can be also ran in Code Cleanup.