Back to Devexpress

Member Sections

coderushforroslyn-400452-coding-assistance-code-templates-member-sections.md

latest3.1 KB
Original Source

Member Sections

  • Jan 31, 2023
  • 3 minutes to read

CodeRush can place properties, methods, and fields in dedicated target sections when you expand templates.

You can, for instance, expand the “ pb “ template to create a Boolean property. To do this, type the template name and press Space or Tab depending on your settings.

Note

The Member Sections feature is initially enabled. To disable this feature, uncheck the Use Member Sections checkbox in the Editor | All Languages | Organize Members options page.

You can also customize whether CodeRush should add a comment to fields, methods, or properties section, or wrap this section into a region when you expand a template. See sections below for details.

Important

Visual Studio IntelliSense has priority over CodeRush templates. For information on how to prioritize a CodeRush template over Visual Studio IntelliSense , refer to the following topic section: Expand a Template Instead of Visual Studio IntelliSense.

Add a Comment in the Start of a Section

Follow the steps below.

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

  2. Select the “Fields” rule and click the Comment button.

  3. Type a comment, for example, “Fields…” in the “Comment” text field and press Enter.

  4. To allow CodeRush to insert a comment into a template expansion, perform the following actions:

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

  6. Switch to the code editor and expand a template. For example, expand the “ pb “ and “ ps “ templates to create Boolean and String properties, respectively.

CodeRush adds the “Field…” comment for fields.

Wrap a Section into a Region

Follow the steps below to customize this behavior.

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

  2. Select the “Fields” rule and click the Region button.

  3. Type “Fields…” in the “Region name” field.

  4. To allow CodeRush to add a region to a template expansion, perform the following actions:

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

  6. Switch to the code editor and expand a template. For instance, expand “ pb “ and “ ps “ templates to create Boolean and String properties, respectively.

CodeRush wraps the fields into the “Fields…” region.

See Also

Common Templates