Skip to main content

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.