All docs
V20.1
20.1
19.2
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

Braces

  • 2 minutes to read

The Braces page contains options which allow you to configure line breaks around and within the following code blocks:

  • Namespace
  • Type
  • Simple Method
  • Method
  • Property \ Indexer \ Event
  • Interface and Auto-Implemented Property
  • Simple Property \ Indexer \ Event
  • Accessor
  • Simple Accessor
  • Lambda Expression \ Anonymous Method
  • Statement
  • Simple Statement
  • Empty Block

Formatting_Braces

Each element has separate configuration options. You can set the following wrapping options:

  • How CodeRush should wrap open and close braces:

    • No wrap - does not add extra line breaks. This option removes existing line breaks if the Keep existing line breaks checkbox is not checked in the Editor | C# | Formatting | General options page.
    • Wrap if Long or Multiline - adds line breaks to wrap each expression element if the line exceeds the margin.
    • Simple Wrap - adds line breaks to wrap only those expression elements that exceed the margin.
    • Wrap - wraps all code elements regardless of the right margin.
  • The line break's position before or after a code element.

  • Align by - allows CodeRush to align braces to an element in the first line.

  • Align content by - allows you to specify how to align code blocks.

  • Indent - allows you to specify code lines' indentation.

NOTE

CodeRush produces indents in the same way as Visual Studio formatting based on an .editorconfig file or Visual Studio's indentation options (Text Editor\ C# \Tabs) if these options do not exist in the .editorconfig file.