EditorConfig properties for C#: Braces Layout
Last modified: 28 December 2022 This page lists custom ReSharper EditorConfig properties that you can use to configure formatting preferences in C#, specifically, how ReSharper arranges braces when it generates new and reformats existing code; in particular, there are several ways to position braces after if
or for
operators.
tip
Formatting preferences listed on this page can be also configured visually, on the Code Editing | C# | Formatting Style | Braces Layout page of ReSharper options (Alt+R, O).
Braces layout
Type and namespace declaration
Property names:
[resharper_]csharp_type_declaration_braces
, [resharper_]csharp_brace_style
, [resharper_]type_declaration_braces
, [resharper_]brace_style
Possible values:
end_of_line
: At the end of line (K&R style)end_of_line_no_space
: At the end of line (no space)next_line
: At next line (BSD style)next_line_shifted
: At next line indented (Whitesmiths style)next_line_shifted_2
: At next line indented 2 (GNU style)pico
: Compact (Pico style)
Examples:
end_of_line |
---|
|
end_of_line_no_space |
---|
|
next_line |
---|
|
next_line_shifted |
---|
|
next_line_shifted_2 |
---|
|
pico |
---|
|
Indent inside namespace declaration
Property names:
[resharper_]csharp_indent_inside_namespace
, [resharper_]indent_inside_namespace
Possible values:
true | false
Examples:
true |
---|
|
false |
---|
|
Method declaration
Property names:
[resharper_]csharp_invocable_declaration_braces
, [resharper_]csharp_brace_style
, [resharper_]invocable_declaration_braces
, [resharper_]brace_style
Possible values:
end_of_line
: At the end of line (K&R style)end_of_line_no_space
: At the end of line (no space)next_line
: At next line (BSD style)next_line_shifted
: At next line indented (Whitesmiths style)next_line_shifted_2
: At next line indented 2 (GNU style)pico
: Compact (Pico style)
Examples:
end_of_line |
---|
|
end_of_line_no_space |
---|
|
next_line |
---|
|
next_line_shifted |
---|
|
next_line_shifted_2 |
---|
|
pico |
---|
|
Lambda and delegate (anonymous method declaration)
Property names:
[resharper_]csharp_anonymous_method_declaration_braces
, [resharper_]csharp_brace_style
, [resharper_]anonymous_method_declaration_braces
, [resharper_]brace_style
Possible values:
end_of_line
: At the end of line (K&R style)end_of_line_no_space
: At the end of line (no space)next_line
: At next line (BSD style)next_line_shifted
: At next line indented (Whitesmiths style)next_line_shifted_2
: At next line indented 2 (GNU style)pico
: Compact (Pico style)
Examples:
end_of_line |
---|
|
end_of_line_no_space |
---|
|
next_line |
---|
|
next_line_shifted |
---|
|
next_line_shifted_2 |
---|
|
pico |
---|
|
Property declaration
Property names:
[resharper_]csharp_accessor_owner_declaration_braces
, [resharper_]csharp_brace_style
, [resharper_]accessor_owner_declaration_braces
, [resharper_]brace_style
Possible values:
end_of_line
: At the end of line (K&R style)end_of_line_no_space
: At the end of line (no space)next_line
: At next line (BSD style)next_line_shifted
: At next line indented (Whitesmiths style)next_line_shifted_2
: At next line indented 2 (GNU style)pico
: Compact (Pico style)
Examples:
end_of_line |
---|
|
end_of_line_no_space |
---|
|
next_line |
---|
|
next_line_shifted |
---|
|
next_line_shifted_2 |
---|
|
pico |
---|
|
Accessor declaration
Property names:
[resharper_]csharp_accessor_declaration_braces
, [resharper_]csharp_brace_style
, [resharper_]accessor_declaration_braces
, [resharper_]brace_style
Possible values:
end_of_line
: At the end of line (K&R style)end_of_line_no_space
: At the end of line (no space)next_line
: At next line (BSD style)next_line_shifted
: At next line indented (Whitesmiths style)next_line_shifted_2
: At next line indented 2 (GNU style)pico
: Compact (Pico style)
Examples:
end_of_line |
---|
|
end_of_line_no_space |
---|
|
next_line |
---|
|
next_line_shifted |
---|
|
next_line_shifted_2 |
---|
|
pico |
---|
|
Block under "case" label
Property names:
[resharper_]csharp_case_block_braces
, [resharper_]csharp_brace_style
, [resharper_]case_block_braces
, [resharper_]brace_style
Possible values:
end_of_line
: At the end of line (K&R style)end_of_line_no_space
: At the end of line (no space)next_line
: At next line (BSD style)next_line_shifted
: At next line indented (Whitesmiths style)next_line_shifted_2
: At next line indented 2 (GNU style)pico
: Compact (Pico style)
Examples:
end_of_line |
---|
|
end_of_line_no_space |
---|
|
next_line |
---|
|
next_line_shifted |
---|
|
next_line_shifted_2 |
---|
|
pico |
---|
|
Expressions (initializers, switch expressions, patterns)
Property names:
[resharper_]csharp_initializer_braces
, [resharper_]csharp_brace_style
, [resharper_]initializer_braces
, [resharper_]brace_style
Possible values:
end_of_line
: At the end of line (K&R style)end_of_line_no_space
: At the end of line (no space)next_line
: At next line (BSD style)next_line_shifted
: At next line indented (Whitesmiths style)next_line_shifted_2
: At next line indented 2 (GNU style)pico
: Compact (Pico style)
Examples:
end_of_line |
---|
|
end_of_line_no_space |
---|
|
next_line |
---|
|
next_line_shifted |
---|
|
next_line_shifted_2 |
---|
|
pico |
---|
|
Use continuous line indent inside expression braces
Property names:
[resharper_]csharp_use_continuous_indent_inside_initializer_braces
, [resharper_]use_continuous_indent_inside_initializer_braces
Possible values:
true | false
Examples:
true |
---|
|
false |
---|
|
Other
Property names:
[resharper_]csharp_other_braces
, [resharper_]csharp_brace_style
, [resharper_]other_braces
, [resharper_]brace_style
Possible values:
end_of_line
: At the end of line (K&R style)end_of_line_no_space
: At the end of line (no space)next_line
: At next line (BSD style)next_line_shifted
: At next line indented (Whitesmiths style)next_line_shifted_2
: At next line indented 2 (GNU style)pico
: Compact (Pico style)
Examples:
end_of_line |
---|
|
end_of_line_no_space |
---|
|
next_line |
---|
|
next_line_shifted |
---|
|
next_line_shifted_2 |
---|
|
pico |
---|
|
Allow comment after '{'
Property names:
[resharper_]csharp_allow_comment_after_lbrace
, [resharper_]allow_comment_after_lbrace
Possible values:
true | false
Examples:
true |
---|
|
false |
---|
|
Empty braces formatting
Property names:
[resharper_]csharp_empty_block_style
, [resharper_]empty_block_style
Possible values:
multiline
: On different linestogether
: Place braces togethertogether_same_line
: Together on the same line
Examples:
multiline |
---|
|
together |
---|
|
together_same_line |
---|
|