[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
   Code Cleanup
   Remove Unused Assembly References
   Document Formatting (C#)
   Document Formatting (XAML)
   Member Organization
   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)

Programming Style Rules

With CodeRush, you can define a set of programming style rules that automatically apply to your code when you are refactoring, expanding templates and performing Code Cleanup.

You can configure your code preferences in the Editor | <Language> | Programming Style options page.

Below is a list of configurable code style aspects, each with an example of different code styles:

  • Local declaration style

    Defines whether to use explicitly-typed or implicitly-typed variable declarations.

    You can change the existing code according to this style using the Apply variable declaration style Code Cleanup rule.

  • Type/Member visibility modifiers

    Defines whether to add visibility modifiers (private, public, etc.) or remove them from places where they do not change code behavior.

    You can change the existing code according to this style using the Apply visibility style Code Cleanup rule.

  • Order of modifiers

    Defines the required order of member's modifiers.

    You can change the existing code according to this style using the Sort modifiers Code Cleanup rule.

  • Built-in type names

    Defines whether to use the CLR types or their keyword aliases.

    You can change the existing code according to this style using the Apply built-in type style Code Cleanup rule.

  • 'this'/'Me' qualifier usage

    Defines whether to add or remove the 'this'/'Me' qualifier in places where it does not change code behavior.

    You can change the existing code according to this style using the Apply 'this' qualifier style Code Cleanup rule.

  • Namespace references declaration style

    Defines the namespace references declaration style. Refer to the examples below for differences between options.

  • Use braces in statements

    Defines the style for insignificant braces around blocks with a single statement.

    You can change the existing code according to this style using the Apply 'Braces in statements' style Code Cleanup rule.

  • Optional parenthesis

    Defines where the optional parenthesis should be explicitly added or omitted.

    You can change the existing code according to this style using the Apply 'Optional parenthesis' style Code Cleanup rule.

  • Attribute list

    Defines the style for member attributes when several attributes are applied at once.

    You can change the existing code according to this style using the Apply 'Attribute lists' style or Apply 'Attribute lists' style to assembly-level attributes Code Cleanup rule.

Note

This feature is available as a part of Code Cleanup.

Expanded See Also

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