C# - Line Breaks
- Preserve Existing Formatting
- Place on New Line
- Line Wrapping
- Right margin (columns)
- Wrap formal parameters
- Prefer wrap before "(" in declaration
- Prefer wrap after "(" in declaration
- Wrap invocation arguments
- Prefer wrap before "(" in invocation
- Prefer wrap after "(" in invocation
- Prefer wrap before ","
- Prefer wrap after "."
- Wrap chained method calls
- Prefer wrap before ":"
- Wrap extends/implements list
- Wrap "for" statement header
- Prefer wrap before "?" and ":" in ternary expressions
- Wrap ternary expression
- Wrap multiple declaration
- Wrap LINQ expressions
- Prefer wrap before operator in binary expression
- Wrap chained binary expressions
- Force chop compound condition in "if" statement
- Force chop compound condition in "while" statement
- Force chop compound condition in "do" statement
- Wrap multiple type parameter constraints
- Wrap object and collection initializer
- Wrap array initializer
- Prefer wrap before first constraint
- Prefer wrap before type parameters opening angle
- Other
- Place abstract/auto property/indexer/event declaration on single line
- Place simple property/indexer/event declaration on single line
- Place it on single line even when it has attributes on accessors
- Place simple accessor on single line
- Place simple method on single line
- Place simple anonymous method on single line
- Place simple array, object and collection on single line
- Place type attribute on same line
- Place method attribute on same line
- Place property/indexer/event attribute on same line
- Place singleline accessor attribute on same line
- Place multiline accessor attribute on same line
- Place field attribute on same line
- Place constructor initializer on same line
- Place type constraints on same line
- Allow comment after '{'
Preserve Existing Formatting
Keep existing line breaks
Property names:
[resharper_]csharp_keep_user_linebreaks
, [resharper_]keep_user_linebreaks
Possible values:
true | false
Examples:
Break line in single embedded statement
Property names:
[resharper_]csharp_simple_embedded_statement_style
, [resharper_]simple_embedded_statement_style
Possible values:
Examples:
Break line in single "case" statement
Property names:
[resharper_]csharp_simple_case_statement_style
, [resharper_]simple_case_statement_style
Possible values:
Examples:
Break line in a block with a single statement
Property names:
[resharper_]csharp_simple_embedded_block_style
, [resharper_]simple_embedded_block_style
Possible values:
Examples:
Place on New Line
Place "else" on new line
Property names:
csharp_new_line_before_else
, new_line_before_else
Possible values:
true | false
Examples:
true |
if·(condition)
{
····foo();
}
else
{
····foo();
} |
false |
if·(condition)
{
····foo();
}·else
{
····foo();
} |
Place "while" on new line
Property names:
[resharper_]csharp_new_line_before_while
, [resharper_]new_line_before_while
Possible values:
true | false
Examples:
Place "catch" on new line
Property names:
csharp_new_line_before_catch
, new_line_before_catch
Possible values:
true | false
Examples:
true |
try
{
····foo();
}
catch·(Exception·e)
{
····foo();
}
finally
{
} |
false |
try
{
····foo();
}·catch·(Exception·e)
{
····foo();
}
finally
{
} |
Place "finally" on new line
Property names:
csharp_new_line_before_finally
, new_line_before_finally
Possible values:
true | false
Examples:
true |
try
{
····foo();
}
catch·(Exception·e)
{
····foo();
}
finally
{
} |
false |
try
{
····foo();
}
catch·(Exception·e)
{
····foo();
}·finally
{
} |
Line Wrapping
Right margin (columns)
Property names:
csharp_max_line_length
, max_line_length
Possible values:
an integer
Wrap formal parameters
Property names:
[resharper_]csharp_wrap_parameters_style
, [resharper_]wrap_parameters_style
Possible values:
Examples:
Prefer wrap before "(" in declaration
Property names:
[resharper_]csharp_wrap_before_declaration_lpar
, [resharper_]wrap_before_declaration_lpar
Possible values:
true | false
Examples:
true |
void·SomeMethod
(int·p1,·int·p2,·int·p3,
····int·p4)
{
} |
false |
void·SomeMethod(int·p1,·int·p2,
····int·p3,·int·p4)
{
} |
Prefer wrap after "(" in declaration
Property names:
[resharper_]csharp_wrap_after_declaration_lpar
, [resharper_]wrap_after_declaration_lpar
Possible values:
true | false
Examples:
true |
void·SomeMethod(
····int·p1,·int·p2,·int·p3,
····int·p4)
{
} |
false |
void·SomeMethod(int·p1,·int·p2,
····int·p3,·int·p4)
{
} |
Wrap invocation arguments
Property names:
[resharper_]csharp_wrap_arguments_style
, [resharper_]wrap_arguments_style
Possible values:
Examples:
chop_always |
CallMethod(arg1,
····arg2,
····arg3,
····arg4,
····arg5); |
chop_if_long |
CallMethod(arg1,
····arg2,
····arg3,
····arg4,
····arg5); |
wrap_if_long |
CallMethod(arg1,·arg2,·arg3,
····arg4,·arg5); |
Prefer wrap before "(" in invocation
Property names:
[resharper_]csharp_wrap_before_invocation_lpar
, [resharper_]wrap_before_invocation_lpar
Possible values:
true | false
Examples:
true |
CallMethod
(arg1,·arg2,·arg3,·arg4,
····arg5); |
false |
CallMethod(arg1,·arg2,·arg3,
····arg4,·arg5); |
Prefer wrap after "(" in invocation
Property names:
[resharper_]csharp_wrap_after_invocation_lpar
, [resharper_]wrap_after_invocation_lpar
Possible values:
true | false
Examples:
true |
CallMethod(
····arg1,·arg2,·arg3,·arg4,
····arg5); |
false |
CallMethod(arg1,·arg2,·arg3,
····arg4,·arg5); |
Prefer wrap before ","
Property names:
[resharper_]csharp_wrap_before_comma
, [resharper_]wrap_before_comma
Possible values:
true | false
Examples:
true |
CallMethod(arg1,·arg2,·arg3
····,·arg4,·arg5,·arg6,·arg7); |
false |
CallMethod(arg1,·arg2,·arg3,
····arg4,·arg5,·arg6,·arg7); |
Prefer wrap after "."
Property names:
[resharper_]csharp_wrap_after_dot_in_method_calls
, [resharper_]wrap_after_dot_in_method_calls
Possible values:
true | false
Examples:
Wrap chained method calls
Property names:
[resharper_]csharp_wrap_chained_method_calls
, [resharper_]wrap_chained_method_calls
Possible values:
Examples:
Prefer wrap before ":"
Property names:
[resharper_]csharp_wrap_before_extends_colon
, [resharper_]wrap_before_extends_colon
Possible values:
true | false
Examples:
true |
class·Derived
····:·BaseClass,·I1,·I2,·I3,·I4
{
} |
false |
class·Derived·:·BaseClass,·I1,
····I2,·I3,·I4
{
} |
Wrap extends/implements list
Property names:
[resharper_]csharp_wrap_extends_list_style
, [resharper_]wrap_extends_list_style
Possible values:
Examples:
Wrap "for" statement header
Property names:
[resharper_]csharp_wrap_for_stmt_header_style
, [resharper_]wrap_for_stmt_header_style
Possible values:
Examples:
chop_always |
for·(int·i·=·initial;
····i·<·loopLimit;
····i++)
{
} |
chop_if_long |
for·(int·i·=·initial;
····i·<·loopLimit;
····i++)
{
} |
wrap_if_long |
for·(int·i·=·initial;
····i·<·loopLimit;·i++)
{
} |
Prefer wrap before "?" and ":" in ternary expressions
Property names:
[resharper_]csharp_wrap_before_ternary_opsigns
, [resharper_]wrap_before_ternary_opsigns
Possible values:
true | false
Examples:
true |
return
····hereGoesSomeBoolExpression
········?·returnThisIfTrue
········:·returnThatIfFalse; |
false |
return
····hereGoesSomeBoolExpression·?
········returnThisIfTrue·:
········returnThatIfFalse; |
Wrap ternary expression
Property names:
[resharper_]csharp_wrap_ternary_expr_style
, [resharper_]wrap_ternary_expr_style
Possible values:
Examples:
chop_always |
myField·=·someCondition
····?·true
····:·false; |
chop_if_long |
myField·=·someCondition
····?·true
····:·false; |
wrap_if_long |
myField·=·someCondition·?·true
····:·false; |
Wrap multiple declaration
Property names:
[resharper_]csharp_wrap_multiple_declaration_style
, [resharper_]wrap_multiple_declaration_style
Possible values:
Examples:
Wrap LINQ expressions
Property names:
[resharper_]csharp_wrap_linq_expressions
, [resharper_]wrap_linq_expressions
Possible values:
Examples:
Prefer wrap before operator in binary expression
Property names:
[resharper_]csharp_wrap_before_binary_opsign
, [resharper_]wrap_before_binary_opsign
Possible values:
true | false
Examples:
Wrap chained binary expressions
Property names:
[resharper_]csharp_wrap_chained_binary_expressions
, [resharper_]wrap_chained_binary_expressions
Possible values:
Examples:
Force chop compound condition in "if" statement
Property names:
[resharper_]csharp_force_chop_compound_if_expression
, [resharper_]force_chop_compound_if_expression
Possible values:
true | false
Examples:
true |
if·(var1·==·null·||
····var2·==·null)
····Foo(); |
false |
if·(var1·==·null·||·var2·==·null)
····Foo(); |
Force chop compound condition in "while" statement
Property names:
[resharper_]csharp_force_chop_compound_while_expression
, [resharper_]force_chop_compound_while_expression
Possible values:
true | false
Examples:
true |
while·(var1·==·null·||
·······var2·==·null)
····Foo(); |
false |
while·(var1·==·null·||·var2·==·null)
····Foo(); |
Force chop compound condition in "do" statement
Property names:
[resharper_]csharp_force_chop_compound_do_expression
, [resharper_]force_chop_compound_do_expression
Possible values:
true | false
Examples:
true |
do
{
····Foo();
}·while·(var1·==·null·||
·········var2·==·null); |
false |
do
{
····Foo();
}·while·(var1·==·null·||·var2·==·null); |
Wrap multiple type parameter constraints
Property names:
[resharper_]csharp_wrap_multiple_type_parameer_constraints_style
, [resharper_]wrap_multiple_type_parameer_constraints_style
Possible values:
Examples:
Wrap object and collection initializer
Property names:
[resharper_]csharp_wrap_object_and_collection_initializer_style
, [resharper_]wrap_object_and_collection_initializer_style
Possible values:
Examples:
Wrap array initializer
Property names:
[resharper_]csharp_wrap_array_initializer_style
, [resharper_]wrap_array_initializer_style
Possible values:
Examples:
Prefer wrap before first constraint
Property names:
[resharper_]csharp_wrap_before_first_type_parameter_constraint
, [resharper_]wrap_before_first_type_parameter_constraint
Possible values:
true | false
Examples:
true |
class·C<T1,·T2,·T3>
····where·T1·:·I1
····where·T2·:·new()
····where·T3·:·class |
false |
class·C<T1,·T2,·T3>·where·T1·:·I1
····where·T2·:·new()
····where·T3·:·class |
Prefer wrap before type parameters opening angle
Property names:
[resharper_]csharp_wrap_before_type_parameter_langle
, [resharper_]wrap_before_type_parameter_langle
Possible values:
true | false
Examples:
Other
Place abstract/auto property/indexer/event declaration on single line
Property names:
[resharper_]csharp_place_abstract_accessorholder_on_single_line
, [resharper_]csharp_place_simple_blocks_on_single_line
, [resharper_]place_abstract_accessorholder_on_single_line
, [resharper_]place_simple_blocks_on_single_line
Possible values:
true | false
Examples:
true |
interface·I
{
····int·Property·{·get;·set;·}
} |
false |
interface·I
{
····int·Property
····{
········get;
········set;
····}
} |
Place simple property/indexer/event declaration on single line
Property names:
[resharper_]csharp_place_simple_accessorholder_on_single_line
, [resharper_]csharp_place_simple_blocks_on_single_line
, [resharper_]place_simple_accessorholder_on_single_line
, [resharper_]place_simple_blocks_on_single_line
Possible values:
true | false
Examples:
true |
class·C
{
····int·Property·{·get·{·return·x;·}·set·{·x·=·value;·}·}
} |
false |
class·C
{
····int·Property
····{
········get·{·return·x;·}
········set·{·x·=·value;·}
····}
} |
Place it on single line even when it has attributes on accessors
Property names:
[resharper_]csharp_place_accessor_with_attrs_holder_on_single_line
, [resharper_]csharp_place_simple_blocks_on_single_line
, [resharper_]place_accessor_with_attrs_holder_on_single_line
, [resharper_]place_simple_blocks_on_single_line
Possible values:
true | false
Examples:
Place simple accessor on single line
Property names:
[resharper_]csharp_place_simple_accessor_on_single_line
, [resharper_]csharp_place_simple_blocks_on_single_line
, [resharper_]place_simple_accessor_on_single_line
, [resharper_]place_simple_blocks_on_single_line
Possible values:
true | false
Examples:
Place simple method on single line
Property names:
[resharper_]csharp_place_simple_method_on_single_line
, [resharper_]csharp_place_simple_blocks_on_single_line
, [resharper_]place_simple_method_on_single_line
, [resharper_]place_simple_blocks_on_single_line
Possible values:
true | false
Examples:
true |
class·C
{
····void·Foo()·{·DoSomethingSimple();·}
} |
false |
class·C
{
····void·Foo()
····{
········DoSomethingSimple();
····}
} |
Place simple anonymous method on single line
Property names:
[resharper_]csharp_place_simple_anonymousmethod_on_single_line
, [resharper_]csharp_place_simple_blocks_on_single_line
, [resharper_]place_simple_anonymousmethod_on_single_line
, [resharper_]place_simple_blocks_on_single_line
Possible values:
true | false
Examples:
Place simple array, object and collection on single line
Property names:
[resharper_]csharp_place_simple_initializer_on_single_line
, [resharper_]place_simple_initializer_on_single_line
Possible values:
true | false
Examples:
Before formatting | After formatting, true |
var·result·=·new·{·A·=·0·}; | var·result·=·new·{A·=·0}; |
Before formatting | After formatting, false |
var·result·=·new·{·A·=·0·}; | var·result·=·new
{
····A·=·0
}; |
Place type attribute on same line
Property names:
[resharper_]csharp_place_type_attribute_on_same_line
, [resharper_]place_type_attribute_on_same_line
Possible values:
true | false
Examples:
Place method attribute on same line
Property names:
[resharper_]csharp_place_method_attribute_on_same_line
, [resharper_]place_method_attribute_on_same_line
Possible values:
true | false
Examples:
true |
class·C
{
····[Attribute]·void·foo()
····{
····}
} |
false |
class·C
{
····[Attribute]
····void·foo()
····{
····}
} |
Place property/indexer/event attribute on same line
Property names:
[resharper_]csharp_place_accessorholder_attribute_on_same_line
, [resharper_]place_accessorholder_attribute_on_same_line
Possible values:
true | false
Examples:
Place singleline accessor attribute on same line
Property names:
[resharper_]csharp_place_simple_accessor_attribute_on_same_line
, [resharper_]place_simple_accessor_attribute_on_same_line
Possible values:
true | false
Examples:
Place multiline accessor attribute on same line
Property names:
[resharper_]csharp_place_complex_accessor_attribute_on_same_line
, [resharper_]place_complex_accessor_attribute_on_same_line
Possible values:
true | false
Examples:
Place field attribute on same line
Property names:
[resharper_]csharp_place_field_attribute_on_same_line
, [resharper_]place_field_attribute_on_same_line
Possible values:
true | false
Examples:
Place constructor initializer on same line
Property names:
[resharper_]csharp_place_constructor_initializer_on_same_line
, [resharper_]place_constructor_initializer_on_same_line
Possible values:
true | false
Examples:
true |
class·C
{
····public·C()·:·base()
····{
····}
} |
false |
class·C
{
····public·C()
········:·base()
····{
····}
} |
Place type constraints on same line
Property names:
[resharper_]csharp_place_type_constraints_on_same_line
, [resharper_]place_type_constraints_on_same_line
Possible values:
true | false
Examples:
Allow comment after '{'
Property names:
[resharper_]csharp_allow_comment_after_lbrace
, [resharper_]allow_comment_after_lbrace
Possible values:
true | false
Examples:
true |
if·(condition)
{·//·comment
····statement;
} |
false |
if·(condition)
{
····//·comment
····statement;
} |