[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Collapse]CodeRush
  System Requirements
  Improve Performance
 [Expand]Features by Language
 [Expand]Getting Started
 [Expand]How To
 [Expand]Coding Assistance
 [Expand]Navigation and Search Tools
 [Expand]Static Code Analysis
 [Expand]Visualization Tools
 [Collapse]Code Style Assistance
  [Expand]Code Formatters
   Programming Style Rules
   Naming Conventions
  [Expand]Code Cleanup
   Remove Unused Assembly References
  [Expand]Document Formatting (C#)
   Document Formatting (XAML)
   Organize Members
   Move Member to Region
  Building Assistance
  Debugging Assistance
 [Expand]Refactoring Assistance
 [Expand]Unit Testing Assistance
 [Expand]Decompiling Tools
 [Expand]Configuration Options
 [Expand]Extensibility
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Organize Members

Organize Members allows you to organize type members according to specified rules. This helps you maintain a unified type structure and locate members.

Expanded Configure Organize Members

Access Configuration Settings

Open the Editor | All Languages | Organize Members options page.

Refer to the Organize Members Settings topic for information about Organize Members configuration options.

Choose a Prefefined Rule Set

CodeRush provides two predefined rule sets: Default and StyleCop. These sets can be helpful if you work on projects with different standards.

You can configure rules based on the predefined rule sets or create new rule sets.

Create a Rule Set (Optional)

To create an empty rule set:

  • Click New in the "Rule set" section.

  • Type a rule set name and click OK in the invoked dialog.

CodeRush creates an empty rule set which you can populate with organize members rules.

To create a rule set based on the existing rule set:

  • Choose a rule set which rules CodeRush must clone and click Clone.

  • Type a rule set name and click OK in the invoked dialog.

The screenshot below shows the rule set cloned from StyleCop.

Add and Customize a Rule

You can add rules to any rule set. Refer to the How to Create a Rule example for information on how to add a rule to the Default rule set.

To create rules in a new rule set:

  • Choose an empty rule set.

  • Click Add Rule.

    CodeRush shows the rule options.

  • Type a rule name, for example, Constants.

  • Specify how many empty lines CodeRush should add between members in the "Empty line count between groups" text box (optional).

  • Change the Rule priority (optional). Possible values: Low, Normal, and High. Use this setting to group members with different kinds prior to other rules, for example, explicit interface implementations. See the How to Create Regions for Explicit Interface Implementations example.

  • Set the Node kind to Constant in the "Group by" section.

  • Leave the Sort by settings as is for the Constants rule to sort constants by name.

CodeRush can also sort members by kind, access modifier, visibility, and other criteria. You can specify ascending or descending sort order.

The screenshot below shows the specified Constants rule settings.

  • Click Add Rule to add a rule for Fields.

  • Type "Fields" in the Rule name text box.

  • Set Node kind to Field.

  • Set the "Sort by" to Static.

  • Click Add to add the second "Sort by" criteria. Set the "Sort by" combo box to Name. This allows CodeRush to sort fields by static modifier and by name in ascending order.

The following screenshot shows the specified Fields rule settings.

  • Add the Methods rule.

  • Type "Methods" in the Rule name text box.

  • Set Node kind to Method.

  • Leave the "Sort by" settings as is.

The screenshot below shows the specified Methods rule.

  • Click Apply and OK to save the changes and close the Organize Members window.

Run Organize Members

  • Place the caret in a class member.

  • Press Ctrl+. or Ctrl+~ to invoke the Code Actions Menu.

  • Select Organize Members from the menu.

CodeRush places members into groups and applies members rules according to the specified order (Constants, Fields, and Methods).

Note

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

Expanded See Also

Is this topic helpful?​​​​​​​