Member Organization

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.

Choose a Rule Scheme

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.

Insert Empty Line above and below Members

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.

Specify Empty Line Count between Groups

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.

Skip Initialized Fields

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.

Organize Members with Default Settings

To run Organize Members with the default settings, place the caret in a type declaration and select Organize Members from the menu.

Note

The Organize Members feature can be also ran in Code Cleanup.