Back to Devexpress

How to: Group and Sort Properties with Backing Fields

coderushforroslyn-403212-getting-started-examples-organize-members-how-to-group-and-sort-properties-with-backing-fields.md

latest2.1 KB
Original Source

How to: Group and Sort Properties with Backing Fields

  • Apr 13, 2022
  • 3 minutes to read

Organize Members can group and sort properties with backing fields with the following criteria:

This example describes how to create, configure, and apply rules for properties with backing fields to implement the scenarios described above.

Keep Backing Fields with their Corresponding Properties

  1. Open the Editor | All Languages | Organize Members options page to configure the Organize Members.

  2. Choose the StyleCop rule set in the “Rule set” section.

  3. Select the “Properties” rule.

  4. Change the “Properties” rule settings.

  5. Click Apply and OK to save the changes and close the Organize Members options page.

  6. Copy the following code and paste it in your project.

  7. Run Organize members.

CodeRush places backing fields with their corresponding properties.

Group Properties with Backing Fields by Visibility

  1. Open the Organize Members options page. See the step 1 in the previous section.

  2. Select the “Internal properties” rule in the “Default” rule set.

  3. Change the “Internal properties” rule settings as shown in the screenshot below.

  4. Select the “Public properties” rule and change its settings similarly. The modified rule looks as follows:

  5. Click Apply and OK to save the changes and close the Organize Members options page.

  6. Copy the code from the previous section (see the step 6) and paste it in your project.

  7. Run Organize members.

CodeRush places properties with backing fields according to their visibility.