C# - Line Breaks
General
Keep existing line breaks
Property names:
[resharper_]csharp_keep_user_linebreaks
, [resharper_]csharp_keep_existing_arrangement
, [resharper_]csharp_keep_existing_linebreaks
, [resharper_]keep_user_linebreaks
, [resharper_]keep_existing_arrangement
, [resharper_]keep_existing_linebreaks
Possible values:
true | false
Examples:
Before formatting | After formatting, true |
---|
int·var·=·condition
··?·SomeFunc1()
··:·SomeFunc2(); | int·var·=·condition
····?·SomeFunc1()
····:·SomeFunc2(); |
Before formatting | After formatting, false |
---|
int·var·=·condition
··?·SomeFunc1()
··:·SomeFunc2(); | int·var·=·condition·?·SomeFunc1()·:·SomeFunc2(); |
Right margin (columns)
Property names:
csharp_max_line_length
, max_line_length
This·option·(similarly·to·the·Editorconfig's·'max_line_length')·defines·the·maximum·number·of·characters·in·each·line.·It·is·applied·during·code·reformatting·if·'Wrap·long·lines'·is·enabled.·Line·breaks·are·added·at·the·positions·not·exceeding·the·specified·value,·according·to·the·language·syntax·and·other·line·wrapping·settings.
Possible values:
an integer
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); |
Special "else if" treatment
Property names:
[resharper_]csharp_special_else_if_treatment
, [resharper_]special_else_if_treatment
Possible values:
true | false
Examples:
true |
---|
if·(condition)
{
····foo();
}
else·if·(condition)
{
} |
false |
---|
if·(condition)
{
····foo();
}
else
····if·(condition)
····{
····} |
Line feed at end of file
Property names:
csharp_insert_final_newline
, insert_final_newline
Possible values:
true | false
Arrangement of Attributes
Place attribute section list on separate line if it is longer than
Property names:
[resharper_]csharp_max_attribute_length_for_same_line
, [resharper_]max_attribute_length_for_same_line
Attribute·sections·longer·than·specified·values·would·be·placed·on·separate·line
Possible values:
an integer
Keep existing arrangement of attributes
Property names:
[resharper_]csharp_keep_existing_attribute_arrangement
, [resharper_]csharp_keep_existing_arrangement
, [resharper_]keep_existing_attribute_arrangement
, [resharper_]keep_existing_arrangement
Possible values:
true | false
Examples:
Before formatting | After formatting, true |
---|
[Attribute]
class·C·{}
[Attribute]·class·C1·{} | [Attribute]
class·C·{·}
[Attribute]·class·C1·{·} |
Before formatting | After formatting, false |
---|
[Attribute]
class·C·{}
[Attribute]·class·C1·{} | [Attribute]
class·C·{·}
[Attribute]
class·C1·{·} |
Place type attribute on same line
Property names:
[resharper_]csharp_place_type_attribute_on_same_line
, [resharper_]csharp_place_attribute_on_same_line
, [resharper_]place_type_attribute_on_same_line
, [resharper_]place_attribute_on_same_line
Possible values:
-
False
: Never -
never
: Never -
if_owner_is_single_line
: If owner is singleline -
True
: Always -
always
: Always
Examples:
False |
---|
[Attribute]
class·C·{·}
[Attribute]
class·C1
{
····//·comment·
} |
never |
---|
[Attribute]
class·C·{·}
[Attribute]
class·C1
{
····//·comment·
} |
if_owner_is_single_line |
---|
[Attribute]·class·C·{·}
[Attribute]
class·C1
{
····//·comment·
} |
True |
---|
[Attribute]·class·C·{·}
[Attribute]·class·C1
{
····//·comment·
} |
always |
---|
[Attribute]·class·C·{·}
[Attribute]·class·C1
{
····//·comment·
} |
Place method attribute on same line
Property names:
[resharper_]csharp_place_method_attribute_on_same_line
, [resharper_]csharp_place_attribute_on_same_line
, [resharper_]place_method_attribute_on_same_line
, [resharper_]place_attribute_on_same_line
Possible values:
-
False
: Never -
never
: Never -
if_owner_is_single_line
: If owner is singleline -
True
: Always -
always
: Always
Examples:
False |
---|
interface·I
{
····[Attribute]
····void·foo();
}
class·C
{
····[Attribute]
····void·foo()
····{
········//·comment
····}
} |
never |
---|
interface·I
{
····[Attribute]
····void·foo();
}
class·C
{
····[Attribute]
····void·foo()
····{
········//·comment
····}
} |
if_owner_is_single_line |
---|
interface·I
{
····[Attribute]·void·foo();
}
class·C
{
····[Attribute]
····void·foo()
····{
········//·comment
····}
} |
True |
---|
interface·I
{
····[Attribute]·void·foo();
}
class·C
{
····[Attribute]·void·foo()
····{
········//·comment
····}
} |
always |
---|
interface·I
{
····[Attribute]·void·foo();
}
class·C
{
····[Attribute]·void·foo()
····{
········//·comment
····}
} |
Place property/indexer/event attribute on same line
Property names:
[resharper_]csharp_place_accessorholder_attribute_on_same_line
, [resharper_]csharp_place_attribute_on_same_line
, [resharper_]place_accessorholder_attribute_on_same_line
, [resharper_]place_attribute_on_same_line
Possible values:
-
False
: Never -
never
: Never -
if_owner_is_single_line
: If owner is singleline -
True
: Always -
always
: Always
Examples:
False |
---|
interface·I
{
····[Attribute]
····int·Property·{·get;·}
}
class·C
{
····[Attribute]
····int·Property
····{
········get
········{
············//·comment
············return·x;
········}
····}
} |
never |
---|
interface·I
{
····[Attribute]
····int·Property·{·get;·}
}
class·C
{
····[Attribute]
····int·Property
····{
········get
········{
············//·comment
············return·x;
········}
····}
} |
if_owner_is_single_line |
---|
interface·I
{
····[Attribute]·int·Property·{·get;·}
}
class·C
{
····[Attribute]
····int·Property
····{
········get
········{
············//·comment
············return·x;
········}
····}
} |
True |
---|
interface·I
{
····[Attribute]·int·Property·{·get;·}
}
class·C
{
····[Attribute]·int·Property
····{
········get
········{
············//·comment
············return·x;
········}
····}
} |
always |
---|
interface·I
{
····[Attribute]·int·Property·{·get;·}
}
class·C
{
····[Attribute]·int·Property
····{
········get
········{
············//·comment
············return·x;
········}
····}
} |
Place accessor attribute on same line
Property names:
[resharper_]csharp_place_accessor_attribute_on_same_line
, [resharper_]csharp_place_attribute_on_same_line
, [resharper_]place_accessor_attribute_on_same_line
, [resharper_]place_attribute_on_same_line
Possible values:
-
False
: Never -
never
: Never -
if_owner_is_single_line
: If owner is singleline -
True
: Always -
always
: Always
Examples:
False |
---|
interface·I
{
····int·Property
····{
········[Attribute]
········get;
····}
}
class·C
{
····int·Property
····{
········[Attribute]
········get·{·return·x;·}
········[Attribute]
········set
········{
············x·=·value;
············NotifySomething();
········}
····}
} |
never |
---|
interface·I
{
····int·Property
····{
········[Attribute]
········get;
····}
}
class·C
{
····int·Property
····{
········[Attribute]
········get·{·return·x;·}
········[Attribute]
········set
········{
············x·=·value;
············NotifySomething();
········}
····}
} |
if_owner_is_single_line |
---|
interface·I
{
····int·Property·{·[Attribute]·get;·}
}
class·C
{
····int·Property
····{
········[Attribute]·get·{·return·x;·}
········[Attribute]
········set
········{
············x·=·value;
············NotifySomething();
········}
····}
} |
True |
---|
interface·I
{
····int·Property·{·[Attribute]·get;·}
}
class·C
{
····int·Property
····{
········[Attribute]·get·{·return·x;·}
········[Attribute]·set
········{
············x·=·value;
············NotifySomething();
········}
····}
} |
always |
---|
interface·I
{
····int·Property·{·[Attribute]·get;·}
}
class·C
{
····int·Property
····{
········[Attribute]·get·{·return·x;·}
········[Attribute]·set
········{
············x·=·value;
············NotifySomething();
········}
····}
} |
Place field attribute on same line
Property names:
[resharper_]csharp_place_field_attribute_on_same_line
, [resharper_]csharp_place_attribute_on_same_line
, [resharper_]place_field_attribute_on_same_line
, [resharper_]place_attribute_on_same_line
Possible values:
-
False
: Never -
never
: Never -
if_owner_is_single_line
: If owner is singleline -
True
: Always -
always
: Always
Examples:
False |
---|
class·C
{
····[Attribute]
····int·x;
····[Attribute]
····MyObj·y·=·//·comment·
········new·MyObj();
} |
never |
---|
class·C
{
····[Attribute]
····int·x;
····[Attribute]
····MyObj·y·=·//·comment·
········new·MyObj();
} |
if_owner_is_single_line |
---|
class·C
{
····[Attribute]·int·x;
····[Attribute]
····MyObj·y·=·//·comment·
········new·MyObj();
} |
True |
---|
class·C
{
····[Attribute]·int·x;
····[Attribute]·MyObj·y·=·//·comment·
········new·MyObj();
} |
always |
---|
class·C
{
····[Attribute]·int·x;
····[Attribute]·MyObj·y·=·//·comment·
········new·MyObj();
} |
Arrangement of Method Signatures
Wrap formal parameters
Property names:
[resharper_]csharp_wrap_parameters_style
, [resharper_]wrap_parameters_style
Possible values:
-
wrap_if_long
: Simple wrap -
chop_if_long
: Chop if long or multiline -
chop_always
: Chop always
Examples:
wrap_if_long |
---|
void·SomeMethod(int·p1,·int·p2,
····int·p3,·int·p4)
{
} |
chop_if_long |
---|
void·SomeMethod(int·p1,
····int·p2,
····int·p3,
····int·p4)
{
} |
chop_always |
---|
void·SomeMethod(int·p1,
····int·p2,
····int·p3,
····int·p4)
{
} |
Keep existing arrangement of parenthesis in declaration
Property names:
[resharper_]csharp_keep_existing_declaration_parens_arrangement
, [resharper_]csharp_keep_existing_arrangement
, [resharper_]keep_existing_declaration_parens_arrangement
, [resharper_]keep_existing_arrangement
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 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)
{
} |
Prefer wrap before ")" in declaration
Property names:
[resharper_]csharp_wrap_before_declaration_rpar
, [resharper_]wrap_before_declaration_rpar
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)
{
} |
Allow 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()
····{
····}
} |
Arrangement of Expression Bodied Members
Keep existing arrangement of expression bodied members
Property names:
[resharper_]csharp_keep_existing_expr_member_arrangement
, [resharper_]csharp_keep_existing_arrangement
, [resharper_]keep_existing_expr_member_arrangement
, [resharper_]keep_existing_arrangement
Possible values:
true | false
Examples:
Before formatting | After formatting, true |
---|
class·A
{
··public·int·Foo()·=>·0;
··public·int·Foo1()
····=>·1;
··public·int·Foo2()·=>
····2;
} | class·A
{
····public·int·Foo()·=>·0;
····public·int·Foo1()
········=>·1;
····public·int·Foo2()·=>
········2;
} |
Before formatting | After formatting, false |
---|
class·A
{
··public·int·Foo()·=>·0;
··public·int·Foo1()
····=>·1;
··public·int·Foo2()·=>
····2;
} | class·A
{
····public·int·Foo()·=>·0;
····public·int·Foo1()·=>·1;
····public·int·Foo2()·=>·2;
} |
Place method expression body on same line
Property names:
[resharper_]csharp_place_expr_method_on_single_line
, [resharper_]place_expr_method_on_single_line
Possible values:
-
False
: Never -
never
: Never -
if_owner_is_single_line
: If owner is singleline -
True
: Always -
always
: Always
Examples:
False |
---|
class·A
{
····public·int·Foo()·=>
········0;
····public·int·//·comment
········Foo1()·=>
········1;
····public·int·Foo2()·=>
········1·+·//·comment
········2;
} |
never |
---|
class·A
{
····public·int·Foo()·=>
········0;
····public·int·//·comment
········Foo1()·=>
········1;
····public·int·Foo2()·=>
········1·+·//·comment
········2;
} |
if_owner_is_single_line |
---|
class·A
{
····public·int·Foo()·=>·0;
····public·int·//·comment
········Foo1()·=>
········1;
····public·int·Foo2()·=>
········1·+·//·comment
········2;
} |
True |
---|
class·A
{
····public·int·Foo()·=>·0;
····public·int·//·comment
········Foo1()·=>·1;
····public·int·Foo2()·=>·1·+·//·comment
·························2;
} |
always |
---|
class·A
{
····public·int·Foo()·=>·0;
····public·int·//·comment
········Foo1()·=>·1;
····public·int·Foo2()·=>·1·+·//·comment
·························2;
} |
Place property expression body on same line
Property names:
[resharper_]csharp_place_expr_property_on_single_line
, [resharper_]place_expr_property_on_single_line
Possible values:
-
False
: Never -
never
: Never -
if_owner_is_single_line
: If owner is singleline -
True
: Always -
always
: Always
Examples:
False |
---|
class·A
{
····public·int·Foo·=>
········0;
····public·int·//·comment
········Foo1·=>
········1;
····public·int·Foo2·=>
········1·+·//·comment
········2;
} |
never |
---|
class·A
{
····public·int·Foo·=>
········0;
····public·int·//·comment
········Foo1·=>
········1;
····public·int·Foo2·=>
········1·+·//·comment
········2;
} |
if_owner_is_single_line |
---|
class·A
{
····public·int·Foo·=>·0;
····public·int·//·comment
········Foo1·=>
········1;
····public·int·Foo2·=>
········1·+·//·comment
········2;
} |
True |
---|
class·A
{
····public·int·Foo·=>·0;
····public·int·//·comment
········Foo1·=>·1;
····public·int·Foo2·=>·1·+·//·comment
·······················2;
} |
always |
---|
class·A
{
····public·int·Foo·=>·0;
····public·int·//·comment
········Foo1·=>·1;
····public·int·Foo2·=>·1·+·//·comment
·······················2;
} |
Place property accessor expression body on same line
Property names:
[resharper_]csharp_place_expr_accessor_on_single_line
, [resharper_]place_expr_accessor_on_single_line
Possible values:
-
False
: Never -
never
: Never -
if_owner_is_single_line
: If owner is singleline -
True
: Always -
always
: Always
Examples:
False |
---|
class·A
{
····public·int·Foo
····{
········get·=>
············0;
····}
····public·int·Foo1
····{
········get·=>
············1·+·//·comment
············2;
····}
} |
never |
---|
class·A
{
····public·int·Foo
····{
········get·=>
············0;
····}
····public·int·Foo1
····{
········get·=>
············1·+·//·comment
············2;
····}
} |
if_owner_is_single_line |
---|
class·A
{
····public·int·Foo
····{
········get·=>·0;
····}
····public·int·Foo1
····{
········get·=>
············1·+·//·comment
············2;
····}
} |
True |
---|
class·A
{
····public·int·Foo
····{
········get·=>·0;
····}
····public·int·Foo1
····{
········get·=>·1·+·//·comment
···············2;
····}
} |
always |
---|
class·A
{
····public·int·Foo
····{
········get·=>·0;
····}
····public·int·Foo1
····{
········get·=>·1·+·//·comment
···············2;
····}
} |
Prefer wrap before "=>" followed by expressions
Property names:
[resharper_]csharp_wrap_before_arrow_with_expressions
, [resharper_]wrap_before_arrow_with_expressions
Possible values:
true | false
Examples:
true |
---|
class·A
{
····public·int·Foo(int·y)
········=>·Br(
············y·*·y·+·y·<<
············y·+·y);
····Func<int,·int,·int>
········Method2()
····{
········return·(xxx,·yyy)
············=>·Br(xxx·*·yyy);
····}
} |
false |
---|
class·A
{
····public·int·Foo(int·y)·=>
········Br(y·*·y·+·y·<<·y·+·y);
····Func<int,·int,·int>
········Method2()
····{
········return·(xxx,·yyy)·=>
············Br(xxx·*·yyy);
····}
} |
Arrangement of Type Parameters, Constraints and Base Types
Allow 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:
true |
---|
class·C<T>·where·T·:·IEnumerable
{
} |
false |
---|
class·C<T>
····where·T·:·IEnumerable
{
} |
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 |
Wrap multiple type parameter constraints
Property names:
[resharper_]csharp_wrap_multiple_type_parameter_constraints_style
, [resharper_]wrap_multiple_type_parameter_constraints_style
Possible values:
-
wrap_if_long
: Simple wrap -
chop_if_long
: Chop if long or multiline -
chop_always
: Chop always
Examples:
wrap_if_long |
---|
class·C<T1,·T2,·T3>·where·T1·:·I1·where·T2·:·new()
····where·T3·:·class |
chop_if_long |
---|
class·C<T1,·T2,·T3>·where·T1·:·I1
····where·T2·:·new()
····where·T3·:·class |
chop_always |
---|
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:
true |
---|
class·C
<Type1,·Type2,
····Type3,·Type4>
{
} |
false |
---|
class·C<Type1,·Type2,
····Type3,·Type4>
{
} |
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:
-
wrap_if_long
: Simple wrap -
chop_if_long
: Chop if long or multiline -
chop_always
: Chop always
Examples:
wrap_if_long |
---|
class·Derived·:·BaseClass,·I1,
····I2,·I3,·I4
{
} |
chop_if_long |
---|
class·Derived·:·BaseClass,
····I1,
····I2,
····I3,
····I4
{
} |
chop_always |
---|
class·Derived·:·BaseClass,
····I1,
····I2,
····I3,
····I4
{
} |
Arrangement of Declaration Blocks
Keep existing arrangement of declaration blocks
Property names:
[resharper_]csharp_keep_existing_declaration_block_arrangement
, [resharper_]csharp_keep_existing_arrangement
, [resharper_]keep_existing_declaration_block_arrangement
, [resharper_]keep_existing_arrangement
Possible values:
true | false
Examples:
Before formatting | After formatting, true |
---|
interface·I{
··int·Property·{
get;·set;
}
}
interface·I{int·Property{get;set;}} | interface·I
{
····int·Property
····{
········get;
········set;
····}
}
interface·I
{
····int·Property·{·get;·set;·}
} |
Before formatting | After formatting, false |
---|
interface·I{
··int·Property·{
get;·set;
}
}
interface·I{int·Property{get;set;}} | interface·I
{
····int·Property·{·get;·set;·}
}
interface·I
{
····int·Property·{·get;·set;·}
} |
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_]csharp_place_simple_declaration_blocks_on_single_line
, [resharper_]place_abstract_accessorholder_on_single_line
, [resharper_]place_simple_blocks_on_single_line
, [resharper_]place_simple_declaration_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_]csharp_place_simple_declaration_blocks_on_single_line
, [resharper_]place_simple_accessorholder_on_single_line
, [resharper_]place_simple_blocks_on_single_line
, [resharper_]place_simple_declaration_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_]csharp_place_simple_declaration_blocks_on_single_line
, [resharper_]place_accessor_with_attrs_holder_on_single_line
, [resharper_]place_simple_blocks_on_single_line
, [resharper_]place_simple_declaration_blocks_on_single_line
Possible values:
true | false
Examples:
true |
---|
class·C
{
····int·Property
····{
········[Attr]·get·{·return·x;·}
········[Attr]·set·{·x·=·value;·}
····}
} |
false |
---|
class·C
{
····int·Property
····{
········[Attr]·get·{·return·x;·}
········[Attr]·set·{·x·=·value;·}
····}
} |
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_]csharp_place_simple_declaration_blocks_on_single_line
, [resharper_]place_simple_accessor_on_single_line
, [resharper_]place_simple_blocks_on_single_line
, [resharper_]place_simple_declaration_blocks_on_single_line
Possible values:
true | false
Examples:
true |
---|
class·C
{
····int·Property
····{
········get·{·return·x;·}
········set
········{
············if·(value·==·null)·throw·new·Exception();
········}
····}
} |
false |
---|
class·C
{
····int·Property
····{
········get
········{
············return·x;
········}
········set
········{
············if·(value·==·null)·throw·new·Exception();
········}
····}
} |
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_]csharp_place_simple_declaration_blocks_on_single_line
, [resharper_]place_simple_method_on_single_line
, [resharper_]place_simple_blocks_on_single_line
, [resharper_]place_simple_declaration_blocks_on_single_line
Possible values:
true | false
Examples:
true |
---|
class·C
{
····void·Foo()·{·DoSomethingSimple();·}
} |
false |
---|
class·C
{
····void·Foo()
····{
········DoSomethingSimple();
····}
} |
Arrangement of Statements
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:
true |
---|
do
{
····foo();
}
while·(condition); |
false |
---|
do
{
····foo();
}·while·(condition); |
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
{
····foo();
} |
false |
---|
try
{
····foo();
}·catch·(Exception·e)
{
····foo();
}
finally
{
····foo();
} |
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
{
····foo();
} |
false |
---|
try
{
····foo();
}
catch·(Exception·e)
{
····foo();
}·finally
{
····foo();
} |
Property names:
[resharper_]csharp_wrap_for_stmt_header_style
, [resharper_]wrap_for_stmt_header_style
Possible values:
-
wrap_if_long
: Simple wrap -
chop_if_long
: Chop if long or multiline -
chop_always
: Chop always
Examples:
wrap_if_long |
---|
for·(int·i·=·initial;
····i·<·loopLimit;·i++)
{
} |
chop_if_long |
---|
for·(int·i·=·initial;
····i·<·loopLimit;
····i++)
{
} |
chop_always |
---|
for·(int·i·=·initial;
····i·<·loopLimit;
····i++)
{
} |
Wrap multiple declaration
Property names:
[resharper_]csharp_wrap_multiple_declaration_style
, [resharper_]wrap_multiple_declaration_style
Possible values:
-
wrap_if_long
: Simple wrap -
chop_if_long
: Chop if long or multiline -
chop_always
: Chop always
Examples:
wrap_if_long |
---|
class·C
{
····public·int·i·=·0,·j·=·0,
········k·=·2,·l·=·3,·m·=·4,
········n·=·5;
} |
chop_if_long |
---|
class·C
{
····public·int·i·=·0,
········j·=·0,
········k·=·2,
········l·=·3,
········m·=·4,
········n·=·5;
} |
chop_always |
---|
class·C
{
····public·int·i·=·0,
········j·=·0,
········k·=·2,
········l·=·3,
········m·=·4,
········n·=·5;
} |
Arrangement of Embedded Statements
Keep existing arrangement of embedded statements
Property names:
[resharper_]csharp_keep_existing_embedded_arrangement
, [resharper_]csharp_keep_existing_arrangement
, [resharper_]keep_existing_embedded_arrangement
, [resharper_]keep_existing_arrangement
Possible values:
true | false
Examples:
Before formatting | After formatting, true |
---|
{
··if·(condition)·DoSomething();
··if·(condition1)
····DoSomething1();
} | {
····if·(condition)·DoSomething();
····if·(condition1)
········DoSomething1();
} |
Before formatting | After formatting, false |
---|
{
··if·(condition)·DoSomething();
··if·(condition1)
····DoSomething1();
} | {
····if·(condition)·DoSomething();
····if·(condition1)·DoSomething1();
} |
Place simple embedded statement on same line
Property names:
[resharper_]csharp_place_simple_embedded_statement_on_same_line
, [resharper_]place_simple_embedded_statement_on_same_line
Possible values:
-
False
: Never -
never
: Never -
if_owner_is_single_line
: If owner is singleline -
True
: Always -
always
: Always
Examples:
False |
---|
{
····if·(condition)
········DoSomething();
····if·(condition·&&·//·comment
········condition1)
········DoSomething();
} |
never |
---|
{
····if·(condition)
········DoSomething();
····if·(condition·&&·//·comment
········condition1)
········DoSomething();
} |
if_owner_is_single_line |
---|
{
····if·(condition)·DoSomething();
····if·(condition·&&·//·comment
········condition1)
········DoSomething();
} |
True |
---|
{
····if·(condition)·DoSomething();
····if·(condition·&&·//·comment
········condition1)·DoSomething();
} |
always |
---|
{
····if·(condition)·DoSomething();
····if·(condition·&&·//·comment
········condition1)·DoSomething();
} |
Place simple "case" statement on same line
Property names:
[resharper_]csharp_place_simple_case_statement_on_same_line
, [resharper_]place_simple_case_statement_on_same_line
Possible values:
-
False
: Never -
never
: Never -
if_owner_is_single_line
: If owner is singleline -
True
: Always -
always
: Always
Examples:
False |
---|
switch·(foo)
{
····case·1:
········return·a;
····case·2:
····case·3:
········return·a;
} |
never |
---|
switch·(foo)
{
····case·1:
········return·a;
····case·2:
····case·3:
········return·a;
} |
if_owner_is_single_line |
---|
switch·(foo)
{
····case·1:·return·a;
····case·2:
····case·3:
········return·a;
} |
True |
---|
switch·(foo)
{
····case·1:·return·a;
····case·2:
····case·3:·return·a;
} |
always |
---|
switch·(foo)
{
····case·1:·return·a;
····case·2:
····case·3:·return·a;
} |
Arrangement of Embedded Blocks
Keep existing arrangement of embedded blocks
Property names:
[resharper_]csharp_keep_existing_embedded_block_arrangement
, [resharper_]csharp_keep_existing_arrangement
, [resharper_]keep_existing_embedded_block_arrangement
, [resharper_]keep_existing_arrangement
Possible values:
true | false
Examples:
Before formatting | After formatting, true |
---|
{
··if·(condition)·{·DoSomething();·}
··if·(condition1)
··{
····DoSomething1();
··}
} | {
····if·(condition)·{·DoSomething();·}
····if·(condition1)
····{
········DoSomething1();
····}
} |
Before formatting | After formatting, false |
---|
{
··if·(condition)·{·DoSomething();·}
··if·(condition1)
··{
····DoSomething1();
··}
} | {
····if·(condition)
····{
········DoSomething();
····}
····if·(condition1)
····{
········DoSomething1();
····}
} |
Place a block with a single simple statement on same line
Property names:
[resharper_]csharp_place_simple_embedded_block_on_same_line
, [resharper_]csharp_place_simple_blocks_on_single_line
, [resharper_]place_simple_embedded_block_on_same_line
, [resharper_]place_simple_blocks_on_single_line
Possible values:
true | false
Examples:
true |
---|
if·(condition)·{·DoSomething();·} |
false |
---|
if·(condition)
{
····DoSomething();
} |
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:
true |
---|
EventHandler·e·=·delegate·{·return;·}; |
false |
---|
EventHandler·e·=·delegate
{
····return;
}; |
Arrangement of Initializers
Keep existing arrangement of initializers
Property names:
[resharper_]csharp_keep_existing_initializer_arrangement
, [resharper_]csharp_keep_existing_arrangement
, [resharper_]keep_existing_initializer_arrangement
, [resharper_]keep_existing_arrangement
Possible values:
true | false
Examples:
Before formatting | After formatting, true |
---|
{
··var·result·=·new·{
····A·=·0·
··};
··var·result·=·new·{·A·=·0·};
} | {
····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·};
} | {
····var·result·=·new·{A·=·0};
····var·result·=·new·{A·=·0};
} |
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:
true |
---|
var·result·=·new·{A·=·0}; |
false |
---|
var·result·=·new
{
····A·=·0
}; |
Wrap object and collection initializer
Property names:
[resharper_]csharp_wrap_object_and_collection_initializer_style
, [resharper_]wrap_object_and_collection_initializer_style
Possible values:
-
wrap_if_long
: Simple wrap -
chop_if_long
: Chop if long or multiline -
chop_always
: Chop always
Examples:
wrap_if_long |
---|
new·C()
{
····PropertyX·=·1,·PropertyY·=·2,
····PropertyZ·=·3
} |
chop_if_long |
---|
new·C()
{
····PropertyX·=·1,
····PropertyY·=·2,
····PropertyZ·=·3
} |
chop_always |
---|
new·C()
{
····PropertyX·=·1,
····PropertyY·=·2,
····PropertyZ·=·3
} |
Wrap array initializer
Property names:
[resharper_]csharp_wrap_array_initializer_style
, [resharper_]wrap_array_initializer_style
Possible values:
-
wrap_if_long
: Simple wrap -
chop_if_long
: Chop if long or multiline -
chop_always
: Chop always
Examples:
wrap_if_long |
---|
new·C[]
{
····Element1,·ElementX,·ElementY,
····ElementZ,·ElementZzz
} |
chop_if_long |
---|
new·C[]
{
····Element1,
····ElementX,
····ElementY,
····ElementZ,
····ElementZzz
} |
chop_always |
---|
new·C[]
{
····Element1,
····ElementX,
····ElementY,
····ElementZ,
····ElementZzz
} |
Arrangement of Invocations
Wrap invocation arguments
Property names:
[resharper_]csharp_wrap_arguments_style
, [resharper_]wrap_arguments_style
Possible values:
-
wrap_if_long
: Simple wrap -
chop_if_long
: Chop if long or multiline -
chop_always
: Chop always
Examples:
wrap_if_long |
---|
CallMethod(arg1,·arg2,·arg3,
····arg4,·arg5); |
chop_if_long |
---|
CallMethod(arg1,
····arg2,
····arg3,
····arg4,
····arg5); |
chop_always |
---|
CallMethod(arg1,
····arg2,
····arg3,
····arg4,
····arg5); |
Keep existing arrangement of parenthesis in invocation
Property names:
[resharper_]csharp_keep_existing_invocation_parens_arrangement
, [resharper_]csharp_keep_existing_arrangement
, [resharper_]keep_existing_invocation_parens_arrangement
, [resharper_]keep_existing_arrangement
Possible values:
true | false
Examples:
true |
---|
CallMethod
(
····arg1,·arg2,
····arg3,·arg4,·arg5
); |
false |
---|
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 ")" in invocation
Property names:
[resharper_]csharp_wrap_before_invocation_rpar
, [resharper_]wrap_before_invocation_rpar
Possible values:
true | false
Examples:
true |
---|
CallMethod(arg1,·arg2,
····arg3,·arg4,·arg5
); |
false |
---|
CallMethod(arg1,·arg2,
····arg3,·arg4,·arg5); |
Arrangement of Member Access Expressions
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:
true |
---|
obj.Method().
····Method().
····Method().
····Method().
····Method().
····Method().
····Method().
····Method().
····Method().
····Method(); |
false |
---|
obj.Method()
····.Method()
····.Method()
····.Method()
····.Method()
····.Method()
····.Method()
····.Method()
····.Method()
····.Method(); |
Wrap chained method calls
Property names:
[resharper_]csharp_wrap_chained_method_calls
, [resharper_]wrap_chained_method_calls
Possible values:
-
wrap_if_long
: Simple wrap -
chop_if_long
: Chop if long or multiline -
chop_always
: Chop always
Examples:
wrap_if_long |
---|
obj.Method().Method()·+
····obj.Method().Method()
········.Method().Method()
········.Method().Method()
········.Method().Method()
········.Method().Method(); |
chop_if_long |
---|
obj.Method().Method()·+
····obj.Method()
········.Method()
········.Method()
········.Method()
········.Method()
········.Method()
········.Method()
········.Method()
········.Method()
········.Method(); |
chop_always |
---|
obj.Method()
········.Method()·+
····obj.Method()
········.Method()
········.Method()
········.Method()
········.Method()
········.Method()
········.Method()
········.Method()
········.Method()
········.Method(); |
Arrangement of Binary Expressions
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:
true |
---|
myField1·=·expression1
···········+·expression2
···········+·expression3
···········+·expression4
···········+·expression5
···········+·expression6
···········+·expression7; |
false |
---|
myField1·=·expression1·+
···········expression2·+
···········expression3·+
···········expression4·+
···········expression5·+
···········expression6·+
···········expression7; |
Wrap chained binary expressions
Property names:
[resharper_]csharp_wrap_chained_binary_expressions
, [resharper_]wrap_chained_binary_expressions
Possible values:
-
wrap_if_long
: Simple wrap -
chop_if_long
: Chop if long or multiline
Examples:
wrap_if_long |
---|
b·=·a·!=·b·&&·c·!=·d·&&·e·&&
····f.IsSumOf(g,·h)·&&
····i.Value·==·j·&&·k·==·l·&&
····m·==·n·&&·o·==·p; |
chop_if_long |
---|
b·=·a·!=·b·&&
····c·!=·d·&&
····e·&&
····f.IsSumOf(g,·h)·&&
····i.Value·==·j·&&
····k·==·l·&&
····m·==·n·&&
····o·==·p; |
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); |
Arrangement of Ternary Expressions
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:
-
wrap_if_long
: Simple wrap -
chop_if_long
: Chop if long or multiline -
chop_always
: Chop always
Examples:
wrap_if_long |
---|
myField·=·someCondition·?·true
····:·false; |
chop_if_long |
---|
myField·=·someCondition
····?·true
····:·false; |
chop_always |
---|
myField·=·someCondition
····?·true
····:·false; |
Nested ternary expression style
Property names:
[resharper_]csharp_nested_ternary_style
, [resharper_]nested_ternary_style
Possible values:
-
simple_wrap
: Simple wrap/Do not change -
autodetect
: Chop in existing style -
compact
: Chop in compact style -
expanded
: Chop in expanded style
Examples:
Before formatting | After formatting, simple_wrap |
---|
{
a·=·i·?·"am"·:·you·?·"are"·:·"is";
b·=·error·?·red·:
·warning·?·yellow·:
·green;
c·=·tiger
·?·dangerous·
:·cat
·?·cute·
:·boring;
d·=·roses·?·red·
:·violets·?·blue·
:·so_are_you;
} | {
····a·=·i·?·"am"·:·you·?·"are"
········:·"is";
····b·=·error·?·red·:
········warning·?·yellow·:
········green;
····c·=·tiger
········?·dangerous
········:·cat
············?·cute
············:·boring;
····d·=·roses·?·red
········:·violets·?·blue
········:·so_are_you;
} |
Before formatting | After formatting, autodetect |
---|
{
a·=·i·?·"am"·:·you·?·"are"·:·"is";
b·=·error·?·red·:
·warning·?·yellow·:
·green;
c·=·tiger
·?·dangerous·
:·cat
·?·cute·
:·boring;
d·=·roses·?·red·
:·violets·?·blue·
:·so_are_you;
} | {
····a·=·i·?·"am"·:
········you·?·"are"·:·"is";
····b·=·error·?·red·:
········warning·?·yellow·:
········green;
····c·=·tiger
········?·dangerous
········:·cat
············?·cute
············:·boring;
····d·=·roses·?·red
········:·violets·?·blue
········:·so_are_you;
} |
Before formatting | After formatting, compact |
---|
{
a·=·i·?·"am"·:·you·?·"are"·:·"is";
b·=·error·?·red·:
·warning·?·yellow·:
·green;
c·=·tiger
·?·dangerous·
:·cat
·?·cute·
:·boring;
d·=·roses·?·red·
:·violets·?·blue·
:·so_are_you;
} | {
····a·=·i·?·"am"·:
········you·?·"are"·:·"is";
····b·=·error·?·red·:
········warning·?·yellow·:
········green;
····c·=·tiger·?·dangerous·:
········cat·?·cute·:·boring;
····d·=·roses·?·red·:
········violets·?·blue·:
········so_are_you;
} |
Before formatting | After formatting, expanded |
---|
{
a·=·i·?·"am"·:·you·?·"are"·:·"is";
b·=·error·?·red·:
·warning·?·yellow·:
·green;
c·=·tiger
·?·dangerous·
:·cat
·?·cute·
:·boring;
d·=·roses·?·red·
:·violets·?·blue·
:·so_are_you;
} | {
····a·=·i
········?·"am"
········:·you
············?·"are"
············:·"is";
····b·=·error
········?·red
········:·warning
············?·yellow
············:·green;
····c·=·tiger
········?·dangerous
········:·cat
············?·cute
············:·boring;
····d·=·roses
········?·red
········:·violets
············?·blue
············:·so_are_you;
} |
Arrangement of LINQ Expressions
Wrap LINQ expressions
Property names:
[resharper_]csharp_wrap_linq_expressions
, [resharper_]wrap_linq_expressions
Possible values:
-
wrap_if_long
: Simple wrap -
chop_if_long
: Chop if long or multiline -
chop_always
: Chop always
Examples:
wrap_if_long |
---|
var·result·=·from·x·in·list
····where·cond(x)·select·x; |
chop_if_long |
---|
var·result·=·from·x·in·list
····where·cond(x)
····select·x; |
chop_always |
---|
var·result·=·from·x·in·list
····where·cond(x)
····select·x; |
Prefer wrap before multiline LINQ expressions
Property names:
[resharper_]csharp_wrap_before_linq_expression
, [resharper_]wrap_before_linq_expression
Possible values:
true | false
Examples:
true |
---|
var·result·=
····from·x·in·list
····where·cond(x)
····select·x; |
false |
---|
var·result·=·from·x·in·list
····where·cond(x)
····select·x; |
Place "into" on new line in LINQ expressions
Property names:
[resharper_]csharp_place_linq_into_on_new_line
, [resharper_]place_linq_into_on_new_line
Possible values:
true | false
Examples:
true |
---|
var·q1·=·from·i·in·l
····select·i
····into·j
····where·j·!=·0
····select·j; |
false |
---|
var·q1·=·from·i·in·l
····select·i·into·j
····where·j·!=·0
····select·j; |
Last modified: 20 August 2018