How to: Tune the Member Organizer
- 2 minutes to read
CodeRush Classic Code Cleanup includes the member organization engine. It enables you to group and sort code elements as you need.
The following step-by-step instructions show you how to specify member organization options.
Plan out the way you want to group members.
For example, you can place member groups in the following order.
- Private fields
- Private methods
- Internal fields
- Internal methods
- Public properties
- Public methods
- Public events
Open the Rules options page and set focus on the Organize members rule.
When the Organize members rule is focused, the member organization options become available under the rules list.
Choose the required scope. In this case, Class is the required scope.
Click the button to open the Group properties dialog.
Use this dialog to specify options for the new group:
- Type in the group name.
- Specify the criteria by which code elements should be organized into the required group.
Specify sort order for the elements within the group. For example, order elements by value type name and then by element name.
Check the required order criteria and move the Return type name criterion to the top of the criteria list using the button.
- Check the Wrap in region option and specify the region name to wrap the group into a region.
- Check the Comment before option and specify the comment to insert a comment before the group.
The following image illustrates the Group properties dialog filled for the "Constants" group.
Add other groups in the same way, and sort them in the required order. CodeRush Classic places groups in the code in the same order as they are listed on the options page.
- Click OK to apply changes and close the Options Dialog.