C# - CodeStyle
This page lists custom JetBrains Rider EditorConfig properties that you can use for configuring code syntax style rules. Note that some properties apply to one language while others apply to several languages at once. However, for each multi-language property there is a property that can override it for a specific language, for example, default_private_modifier
and. csharp_default_private_modifier
.
'var' usage in declarations
For built-in types
Property names:
[resharper_]csharp_for_built_in_types
, [resharper_]for_built_in_types
Possible values:
use_var
: Use 'var'use_var_when_evident
: Use 'var' when evidentuse_explicit_type
: Use explicit type
For simple types
Property names:
[resharper_]csharp_for_simple_types
, [resharper_]for_simple_types
Possible values:
use_var
: Use 'var'use_var_when_evident
: Use 'var' when evidentuse_explicit_type
: Use explicit type
Elsewhere
Property names:
[resharper_]csharp_for_other_types
, [resharper_]for_other_types
Possible values:
use_var
: Use 'var'use_var_when_evident
: Use 'var' when evidentuse_explicit_type
: Use explicit type
Prefer Roslyn (Visual Studio) logic for type evidence
Property names:
[resharper_]csharp_use_roslyn_logic_for_evident_types
, [resharper_]use_roslyn_logic_for_evident_types
Possible values:
true | false
Prefer separate declarations for deconstructed variables
Property names:
[resharper_]csharp_prefer_separate_deconstructed_variables_declaration
, [resharper_]prefer_separate_deconstructed_variables_declaration
Possible values:
true | false
Use 'var' keyword for discards
Property names:
[resharper_]csharp_prefer_explicit_discard_declaration
, [resharper_]prefer_explicit_discard_declaration
Possible values:
true | false
Instance members qualification
Use "this." qualifier for
Property names:
[resharper_]csharp_instance_members_qualify_members
, [resharper_]instance_members_qualify_members
Possible values:
none
field
property
event
method
all
Qualify members declared in
Property names:
[resharper_]csharp_instance_members_qualify_declared_in
, [resharper_]instance_members_qualify_declared_in
Possible values:
this_class
: same classbase_class
: base class
Static members qualification
Qualify with the name of
Property names:
[resharper_]csharp_static_members_qualify_with
, [resharper_]static_members_qualify_with
Possible values:
current_type
: Current typedeclared_type
: Declared-in type
Members to qualify
Property names:
[resharper_]csharp_static_members_qualify_members
, [resharper_]static_members_qualify_members
Possible values:
none
field
property
event
method
all
Built-in types
In locals, members and parameters, prefer
Property names:
[resharper_]csharp_builtin_type_reference_style
, [resharper_]builtin_type_reference_style
Possible values:
use_keyword
: Keyworduse_clr_name
: CLR type name
In member access expressions, prefer
Property names:
[resharper_]csharp_builtin_type_reference_for_member_access_style
, [resharper_]builtin_type_reference_for_member_access_style
Possible values:
use_keyword
: Keyworduse_clr_name
: CLR type name
Reference qualification and 'using' directives
Prefer fully qualified references
Property names:
[resharper_]csharp_prefer_qualified_reference
, [resharper_]prefer_qualified_reference
Possible values:
true | false
Add 'using' directive to deepest scope
Property names:
[resharper_]csharp_add_imports_to_deepest_scope
, [resharper_]add_imports_to_deepest_scope
Possible values:
true | false
Place 'System.*' and 'Windows.*' namespaces first when sorting 'using' directives
Property names:
dotnet_sort_system_directives_first
, [resharper_]csharp_sort_usings_with_system_first
, [resharper_]sort_usings_with_system_first
Possible values:
true | false
Prefer fully qualified using name at nested scope
Property names:
[resharper_]csharp_qualified_using_at_nested_scope
, [resharper_]qualified_using_at_nested_scope
Possible values:
true | false
Use using alias directive to resolve conflicts
Property names:
[resharper_]csharp_allow_alias
, [resharper_]allow_alias
Possible values:
true | false
Allow 'global::' prefix use
Property names:
[resharper_]csharp_can_use_global_alias
, [resharper_]can_use_global_alias
Possible values:
true | false
Modifiers
Prefer explicit/implicit private modifier for type members
Property names:
[resharper_]csharp_default_private_modifier
, [resharper_]default_private_modifier
Possible values:
explicit
: Explicitimplicit
: Implicit
Examples:
Before formatting | After formatting, explicit |
---|---|
class C
{
int a;
private int b;
} | internal class C
{
private int a;
private int b;
} |
Before formatting | After formatting, implicit |
---|---|
class C
{
int a;
private int b;
} | internal class C
{
int a;
int b;
} |
Prefer explicit/implicit internal modifier for types
Property names:
[resharper_]csharp_default_internal_modifier
, [resharper_]default_internal_modifier
Possible values:
explicit
: Explicitimplicit
: Implicit
Examples:
Before formatting | After formatting, explicit |
---|---|
namespace N
{
class C { }
internal class D { }
} | namespace N
{
internal class C { }
internal class D { }
} |
Before formatting | After formatting, implicit |
---|---|
namespace N
{
class C { }
internal class D { }
} | namespace N
{
class C { }
class D { }
} |
Modifiers order
Property names:
[resharper_]csharp_modifiers_order
, [resharper_]modifiers_order
Arguments
Skip single arguments
Property names:
[resharper_]csharp_arguments_skip_single
, [resharper_]arguments_skip_single
Possible values:
true | false
Literal values
Property names:
[resharper_]csharp_arguments_literal
, [resharper_]arguments_literal
Possible values:
positional
: Positional argumentnamed
: Named argument
Examples:
Before formatting | After formatting, positional |
---|---|
public class Arguments
{
public void Style()
{
Bar(1, d, true, "abc", Fx.F1, () => Bar(1));
Bar(1, d, true, "abc", Fx.F1, action: () => Bar(1));
Bar(1, d, true, "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, d, true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, y: d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(x: 1, y: d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
}
public void Bar(int x, int y, bool b, string s, Fx e, Action action = null) { }
private enum Fx
{
F1,
F2,
F3
}
} | public class Arguments
{
public void Style()
{
Bar(1, d, true, "abc", Fx.F1, () => Bar(1));
Bar(1, d, true, "abc", Fx.F1, action: () => Bar(1));
Bar(1, d, true, "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, d, true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, y: d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(x: 1, y: d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
}
public void Bar(int x, int y, bool b, string s, Fx e, Action action = null) { }
private enum Fx
{
F1,
F2,
F3
}
} |
Before formatting | After formatting, named |
---|---|
public class Arguments
{
public void Style()
{
Bar(1, d, true, "abc", Fx.F1, () => Bar(1));
Bar(1, d, true, "abc", Fx.F1, action: () => Bar(1));
Bar(1, d, true, "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, d, true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, y: d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(x: 1, y: d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
}
public void Bar(int x, int y, bool b, string s, Fx e, Action action = null) { }
private enum Fx
{
F1,
F2,
F3
}
} | public class Arguments
{
public void Style()
{
Bar(x: 1, d, b: true, "abc", Fx.F1, () => Bar(x: 1));
Bar(x: 1, d, b: true, "abc", Fx.F1, action: () => Bar(x: 1));
Bar(x: 1, d, b: true, "abc", e: Fx.F1, action: () => Bar(x: 1));
Bar(x: 1, d, b: true, s: "abc", e: Fx.F1, action: () => Bar(x: 1));
Bar(x: 1, d, b: true, s: "abc", e: Fx.F1, action: () => Bar(x: 1));
Bar(x: 1, y: d, b: true, s: "abc", e: Fx.F1, action: () => Bar(x: 1));
Bar(x: 1, y: d, b: true, s: "abc", e: Fx.F1, action: () => Bar(x: 1));
}
public void Bar(int x, int y, bool b, string s, Fx e, Action action = null) { }
private enum Fx
{
F1,
F2,
F3
}
} |
String literal values
Property names:
[resharper_]csharp_arguments_string_literal
, [resharper_]arguments_string_literal
Possible values:
positional
: Positional argumentnamed
: Named argument
Examples:
Before formatting | After formatting, positional |
---|---|
public class Arguments
{
public void Style()
{
Bar(1, d, true, "abc", Fx.F1, () => Bar(1));
Bar(1, d, true, "abc", Fx.F1, action: () => Bar(1));
Bar(1, d, true, "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, d, true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, y: d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(x: 1, y: d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
}
public void Bar(int x, int y, bool b, string s, Fx e, Action action = null) { }
private enum Fx
{
F1,
F2,
F3
}
} | public class Arguments
{
public void Style()
{
Bar(1, d, true, "abc", Fx.F1, () => Bar(1));
Bar(1, d, true, "abc", Fx.F1, action: () => Bar(1));
Bar(1, d, true, "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, d, true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, y: d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(x: 1, y: d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
}
public void Bar(int x, int y, bool b, string s, Fx e, Action action = null) { }
private enum Fx
{
F1,
F2,
F3
}
} |
Before formatting | After formatting, named |
---|---|
public class Arguments
{
public void Style()
{
Bar(1, d, true, "abc", Fx.F1, () => Bar(1));
Bar(1, d, true, "abc", Fx.F1, action: () => Bar(1));
Bar(1, d, true, "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, d, true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, y: d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(x: 1, y: d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
}
public void Bar(int x, int y, bool b, string s, Fx e, Action action = null) { }
private enum Fx
{
F1,
F2,
F3
}
} | public class Arguments
{
public void Style()
{
Bar(1, d, true, s: "abc", Fx.F1, () => Bar(1));
Bar(1, d, true, s: "abc", Fx.F1, action: () => Bar(1));
Bar(1, d, true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, d, true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, y: d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(x: 1, y: d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
}
public void Bar(int x, int y, bool b, string s, Fx e, Action action = null) { }
private enum Fx
{
F1,
F2,
F3
}
} |
Named expressions (variables, properties, methods, etc.)
Property names:
[resharper_]csharp_arguments_named
, [resharper_]arguments_named
Possible values:
positional
: Positional argumentnamed
: Named argument
Examples:
Before formatting | After formatting, positional |
---|---|
public class Arguments
{
public void Style()
{
Bar(1, d, true, "abc", Fx.F1, () => Bar(1));
Bar(1, d, true, "abc", Fx.F1, action: () => Bar(1));
Bar(1, d, true, "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, d, true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, y: d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(x: 1, y: d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
}
public void Bar(int x, int y, bool b, string s, Fx e, Action action = null) { }
private enum Fx
{
F1,
F2,
F3
}
} | public class Arguments
{
public void Style()
{
Bar(1, d, true, "abc", Fx.F1, () => Bar(1));
Bar(1, d, true, "abc", Fx.F1, action: () => Bar(1));
Bar(1, d, true, "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, d, true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, y: d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(x: 1, y: d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
}
public void Bar(int x, int y, bool b, string s, Fx e, Action action = null) { }
private enum Fx
{
F1,
F2,
F3
}
} |
Before formatting | After formatting, named |
---|---|
public class Arguments
{
public void Style()
{
Bar(1, d, true, "abc", Fx.F1, () => Bar(1));
Bar(1, d, true, "abc", Fx.F1, action: () => Bar(1));
Bar(1, d, true, "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, d, true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, y: d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(x: 1, y: d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
}
public void Bar(int x, int y, bool b, string s, Fx e, Action action = null) { }
private enum Fx
{
F1,
F2,
F3
}
} | public class Arguments
{
public void Style()
{
Bar(1, y: d, true, "abc", e: Fx.F1, () => Bar(1));
Bar(1, y: d, true, "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, y: d, true, "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, y: d, true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, y: d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, y: d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(x: 1, y: d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
}
public void Bar(int x, int y, bool b, string s, Fx e, Action action = null) { }
private enum Fx
{
F1,
F2,
F3
}
} |
Anonymous methods (delegates and lambdas)
Property names:
[resharper_]csharp_arguments_anonymous_function
, [resharper_]arguments_anonymous_function
Possible values:
positional
: Positional argumentnamed
: Named argument
Examples:
Before formatting | After formatting, positional |
---|---|
public class Arguments
{
public void Style()
{
Bar(1, d, true, "abc", Fx.F1, () => Bar(1));
Bar(1, d, true, "abc", Fx.F1, action: () => Bar(1));
Bar(1, d, true, "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, d, true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, y: d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(x: 1, y: d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
}
public void Bar(int x, int y, bool b, string s, Fx e, Action action = null) { }
private enum Fx
{
F1,
F2,
F3
}
} | public class Arguments
{
public void Style()
{
Bar(1, d, true, "abc", Fx.F1, () => Bar(1));
Bar(1, d, true, "abc", Fx.F1, action: () => Bar(1));
Bar(1, d, true, "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, d, true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, y: d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(x: 1, y: d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
}
public void Bar(int x, int y, bool b, string s, Fx e, Action action = null) { }
private enum Fx
{
F1,
F2,
F3
}
} |
Before formatting | After formatting, named |
---|---|
public class Arguments
{
public void Style()
{
Bar(1, d, true, "abc", Fx.F1, () => Bar(1));
Bar(1, d, true, "abc", Fx.F1, action: () => Bar(1));
Bar(1, d, true, "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, d, true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, y: d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(x: 1, y: d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
}
public void Bar(int x, int y, bool b, string s, Fx e, Action action = null) { }
private enum Fx
{
F1,
F2,
F3
}
} | public class Arguments
{
public void Style()
{
Bar(1, d, true, "abc", Fx.F1, action: () => Bar(1));
Bar(1, d, true, "abc", Fx.F1, action: () => Bar(1));
Bar(1, d, true, "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, d, true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, y: d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(x: 1, y: d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
}
public void Bar(int x, int y, bool b, string s, Fx e, Action action = null) { }
private enum Fx
{
F1,
F2,
F3
}
} |
Other
Property names:
[resharper_]csharp_arguments_other
, [resharper_]arguments_other
Possible values:
positional
: Positional argumentnamed
: Named argument
Examples:
Before formatting | After formatting, positional |
---|---|
public class Arguments
{
public void Style()
{
Bar(1, d, true, "abc", Fx.F1, () => Bar(1));
Bar(1, d, true, "abc", Fx.F1, action: () => Bar(1));
Bar(1, d, true, "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, d, true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, y: d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(x: 1, y: d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
}
public void Bar(int x, int y, bool b, string s, Fx e, Action action = null) { }
private enum Fx
{
F1,
F2,
F3
}
} | public class Arguments
{
public void Style()
{
Bar(1, d, true, "abc", Fx.F1, () => Bar(1));
Bar(1, d, true, "abc", Fx.F1, action: () => Bar(1));
Bar(1, d, true, "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, d, true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, y: d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(x: 1, y: d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
}
public void Bar(int x, int y, bool b, string s, Fx e, Action action = null) { }
private enum Fx
{
F1,
F2,
F3
}
} |
Before formatting | After formatting, named |
---|---|
public class Arguments
{
public void Style()
{
Bar(1, d, true, "abc", Fx.F1, () => Bar(1));
Bar(1, d, true, "abc", Fx.F1, action: () => Bar(1));
Bar(1, d, true, "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, d, true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, y: d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(x: 1, y: d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
}
public void Bar(int x, int y, bool b, string s, Fx e, Action action = null) { }
private enum Fx
{
F1,
F2,
F3
}
} | public class Arguments
{
public void Style()
{
Bar(1, d, true, "abc", Fx.F1, () => Bar(1));
Bar(1, d, true, "abc", Fx.F1, action: () => Bar(1));
Bar(1, d, true, "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, d, true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(1, y: d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
Bar(x: 1, y: d, b: true, s: "abc", e: Fx.F1, action: () => Bar(1));
}
public void Bar(int x, int y, bool b, string s, Fx e, Action action = null) { }
private enum Fx
{
F1,
F2,
F3
}
} |
Parentheses
Remove redundant parentheses
Property names:
[resharper_]csharp_parentheses_redundancy_style
, [resharper_]parentheses_redundancy_style
Possible values:
remove
: Alwaysremove_if_not_clarifies_precedence
: If not clarifies precedence
Examples:
Before formatting | After formatting, remove |
---|---|
void Calculate()
{
var x = 12 - ((3 % 4) * 12);
var y = ((9 >> ((12 + x) - 1)) << (2 + 1)) & ((6 + (4 * 12)) - 1);
var z = ((2 | 7) + 1) & y;
var a = 12 - 3 % 4 * 12;
var b = 9 >> 12 + a - 1 << 2 + 1 & 6 + 4 * 12 - 1;
var c = (2 | 7) + 1 & b;
} | internal void Calculate()
{
var x = 12 - 3 % 4 * 12;
var y = 9 >> 12 + x - 1 << 2 + 1 & 6 + 4 * 12 - 1;
var z = (2 | 7) + 1 & y;
var a = 12 - 3 % 4 * 12;
var b = 9 >> 12 + a - 1 << 2 + 1 & 6 + 4 * 12 - 1;
var c = (2 | 7) + 1 & b;
} |
Before formatting | After formatting, remove_if_not_clarifies_precedence |
---|---|
void Calculate()
{
var x = 12 - ((3 % 4) * 12);
var y = ((9 >> ((12 + x) - 1)) << (2 + 1)) & ((6 + (4 * 12)) - 1);
var z = ((2 | 7) + 1) & y;
var a = 12 - 3 % 4 * 12;
var b = 9 >> 12 + a - 1 << 2 + 1 & 6 + 4 * 12 - 1;
var c = (2 | 7) + 1 & b;
} | internal void Calculate()
{
var x = 12 - 3 % 4 * 12;
var y = ((9 >> (12 + x - 1)) << (2 + 1)) & (6 + 4 * 12 - 1);
var z = ((2 | 7) + 1) & y;
var a = 12 - 3 % 4 * 12;
var b = ((9 >> (12 + a - 1)) << (2 + 1)) & (6 + 4 * 12 - 1);
var c = ((2 | 7) + 1) & b;
} |
Add parenthesis to avoid non-obvious precedence
Around operands of the following operations
Property names:
[resharper_]csharp_parentheses_non_obvious_operations
, [resharper_]parentheses_non_obvious_operations
Possible values:
none
null_coalescing
: ??conditional
: && ||conditional_or
: ||conditional_and
: &&bitwise
: & ^ |bitwise_inclusive_or
: |range
: ..bitwise_exclusive_or
: ^equality
: == !=relational
: < > <= >=shift
: << >>arithmetic
: * / % + -additive
: + -multiplicative
: * / %bitwise_and
: &
Examples:
Before formatting | After formatting, none |
---|---|
void Calculate()
{
var x = 12 - ((3 % 4) * 12);
var y = ((9 >> ((12 + x) - 1)) << (2 + 1)) & ((6 + (4 * 12)) - 1);
var z = ((2 | 7) + 1) & y;
var a = 12 - 3 % 4 * 12;
var b = 9 >> 12 + a - 1 << 2 + 1 & 6 + 4 * 12 - 1;
var c = (2 | 7) + 1 & b;
var d = x > 5 && y < 6 || z == 7;
} | internal void Calculate()
{
var x = 12 - 3 % 4 * 12;
var y = 9 >> 12 + x - 1 << 2 + 1 & 6 + 4 * 12 - 1;
var z = (2 | 7) + 1 & y;
var a = 12 - 3 % 4 * 12;
var b = 9 >> 12 + a - 1 << 2 + 1 & 6 + 4 * 12 - 1;
var c = (2 | 7) + 1 & b;
var d = x > 5 && y < 6 || z == 7;
} |
Before formatting | After formatting, null_coalescing |
---|---|
void Calculate()
{
var x = 12 - ((3 % 4) * 12);
var y = ((9 >> ((12 + x) - 1)) << (2 + 1)) & ((6 + (4 * 12)) - 1);
var z = ((2 | 7) + 1) & y;
var a = 12 - 3 % 4 * 12;
var b = 9 >> 12 + a - 1 << 2 + 1 & 6 + 4 * 12 - 1;
var c = (2 | 7) + 1 & b;
var d = x > 5 && y < 6 || z == 7;
} | internal void Calculate()
{
var x = 12 - 3 % 4 * 12;
var y = 9 >> 12 + x - 1 << 2 + 1 & 6 + 4 * 12 - 1;
var z = (2 | 7) + 1 & y;
var a = 12 - 3 % 4 * 12;
var b = 9 >> 12 + a - 1 << 2 + 1 & 6 + 4 * 12 - 1;
var c = (2 | 7) + 1 & b;
var d = x > 5 && y < 6 || z == 7;
} |
Before formatting | After formatting, conditional |
---|---|
void Calculate()
{
var x = 12 - ((3 % 4) * 12);
var y = ((9 >> ((12 + x) - 1)) << (2 + 1)) & ((6 + (4 * 12)) - 1);
var z = ((2 | 7) + 1) & y;
var a = 12 - 3 % 4 * 12;
var b = 9 >> 12 + a - 1 << 2 + 1 & 6 + 4 * 12 - 1;
var c = (2 | 7) + 1 & b;
var d = x > 5 && y < 6 || z == 7;
} | internal void Calculate()
{
var x = 12 - 3 % 4 * 12;
var y = 9 >> 12 + x - 1 << 2 + 1 & 6 + 4 * 12 - 1;
var z = (2 | 7) + 1 & y;
var a = 12 - 3 % 4 * 12;
var b = 9 >> 12 + a - 1 << 2 + 1 & 6 + 4 * 12 - 1;
var c = (2 | 7) + 1 & b;
var d = ((x > 5) && (y < 6)) || (z == 7);
} |
Before formatting | After formatting, conditional_or |
---|---|
void Calculate()
{
var x = 12 - ((3 % 4) * 12);
var y = ((9 >> ((12 + x) - 1)) << (2 + 1)) & ((6 + (4 * 12)) - 1);
var z = ((2 | 7) + 1) & y;
var a = 12 - 3 % 4 * 12;
var b = 9 >> 12 + a - 1 << 2 + 1 & 6 + 4 * 12 - 1;
var c = (2 | 7) + 1 & b;
var d = x > 5 && y < 6 || z == 7;
} | internal void Calculate()
{
var x = 12 - 3 % 4 * 12;
var y = 9 >> 12 + x - 1 << 2 + 1 & 6 + 4 * 12 - 1;
var z = (2 | 7) + 1 & y;
var a = 12 - 3 % 4 * 12;
var b = 9 >> 12 + a - 1 << 2 + 1 & 6 + 4 * 12 - 1;
var c = (2 | 7) + 1 & b;
var d = (x > 5 && y < 6) || (z == 7);
} |
Before formatting | After formatting, conditional_and |
---|---|
void Calculate()
{
var x = 12 - ((3 % 4) * 12);
var y = ((9 >> ((12 + x) - 1)) << (2 + 1)) & ((6 + (4 * 12)) - 1);
var z = ((2 | 7) + 1) & y;
var a = 12 - 3 % 4 * 12;
var b = 9 >> 12 + a - 1 << 2 + 1 & 6 + 4 * 12 - 1;
var c = (2 | 7) + 1 & b;
var d = x > 5 && y < 6 || z == 7;
} | internal void Calculate()
{
var x = 12 - 3 % 4 * 12;
var y = 9 >> 12 + x - 1 << 2 + 1 & 6 + 4 * 12 - 1;
var z = (2 | 7) + 1 & y;
var a = 12 - 3 % 4 * 12;
var b = 9 >> 12 + a - 1 << 2 + 1 & 6 + 4 * 12 - 1;
var c = (2 | 7) + 1 & b;
var d = (x > 5) && (y < 6) || z == 7;
} |
Before formatting | After formatting, bitwise |
---|---|
void Calculate()
{
var x = 12 - ((3 % 4) * 12);
var y = ((9 >> ((12 + x) - 1)) << (2 + 1)) & ((6 + (4 * 12)) - 1);
var z = ((2 | 7) + 1) & y;
var a = 12 - 3 % 4 * 12;
var b = 9 >> 12 + a - 1 << 2 + 1 & 6 + 4 * 12 - 1;
var c = (2 | 7) + 1 & b;
var d = x > 5 && y < 6 || z == 7;
} | internal void Calculate()
{
var x = 12 - 3 % 4 * 12;
var y = (9 >> 12 + x - 1 << 2 + 1) & (6 + 4 * 12 - 1);
var z = ((2 | 7) + 1) & y;
var a = 12 - 3 % 4 * 12;
var b = (9 >> 12 + a - 1 << 2 + 1) & (6 + 4 * 12 - 1);
var c = ((2 | 7) + 1) & b;
var d = x > 5 && y < 6 || z == 7;
} |
Before formatting | After formatting, bitwise_inclusive_or |
---|---|
void Calculate()
{
var x = 12 - ((3 % 4) * 12);
var y = ((9 >> ((12 + x) - 1)) << (2 + 1)) & ((6 + (4 * 12)) - 1);
var z = ((2 | 7) + 1) & y;
var a = 12 - 3 % 4 * 12;
var b = 9 >> 12 + a - 1 << 2 + 1 & 6 + 4 * 12 - 1;
var c = (2 | 7) + 1 & b;
var d = x > 5 && y < 6 || z == 7;
} | internal void Calculate()
{
var x = 12 - 3 % 4 * 12;
var y = 9 >> 12 + x - 1 << 2 + 1 & 6 + 4 * 12 - 1;
var z = (2 | 7) + 1 & y;
var a = 12 - 3 % 4 * 12;
var b = 9 >> 12 + a - 1 << 2 + 1 & 6 + 4 * 12 - 1;
var c = (2 | 7) + 1 & b;
var d = x > 5 && y < 6 || z == 7;
} |
Before formatting | After formatting, range |
---|---|
void Calculate()
{
var x = 12 - ((3 % 4) * 12);
var y = ((9 >> ((12 + x) - 1)) << (2 + 1)) & ((6 + (4 * 12)) - 1);
var z = ((2 | 7) + 1) & y;
var a = 12 - 3 % 4 * 12;
var b = 9 >> 12 + a - 1 << 2 + 1 & 6 + 4 * 12 - 1;
var c = (2 | 7) + 1 & b;
var d = x > 5 && y < 6 || z == 7;
} | internal void Calculate()
{
var x = 12 - 3 % 4 * 12;
var y = 9 >> 12 + x - 1 << 2 + 1 & 6 + 4 * 12 - 1;
var z = (2 | 7) + 1 & y;
var a = 12 - 3 % 4 * 12;
var b = 9 >> 12 + a - 1 << 2 + 1 & 6 + 4 * 12 - 1;
var c = (2 | 7) + 1 & b;
var d = x > 5 && y < 6 || z == 7;
} |
Before formatting | After formatting, bitwise_exclusive_or |
---|---|
void Calculate()
{
var x = 12 - ((3 % 4) * 12);
var y = ((9 >> ((12 + x) - 1)) << (2 + 1)) & ((6 + (4 * 12)) - 1);
var z = ((2 | 7) + 1) & y;
var a = 12 - 3 % 4 * 12;
var b = 9 >> 12 + a - 1 << 2 + 1 & 6 + 4 * 12 - 1;
var c = (2 | 7) + 1 & b;
var d = x > 5 && y < 6 || z == 7;
} | internal void Calculate()
{
var x = 12 - 3 % 4 * 12;
var y = 9 >> 12 + x - 1 << 2 + 1 & 6 + 4 * 12 - 1;
var z = (2 | 7) + 1 & y;
var a = 12 - 3 % 4 * 12;
var b = 9 >> 12 + a - 1 << 2 + 1 & 6 + 4 * 12 - 1;
var c = (2 | 7) + 1 & b;
var d = x > 5 && y < 6 || z == 7;
} |
Before formatting | After formatting, equality |
---|---|
void Calculate()
{
var x = 12 - ((3 % 4) * 12);
var y = ((9 >> ((12 + x) - 1)) << (2 + 1)) & ((6 + (4 * 12)) - 1);
var z = ((2 | 7) + 1) & y;
var a = 12 - 3 % 4 * 12;
var b = 9 >> 12 + a - 1 << 2 + 1 & 6 + 4 * 12 - 1;
var c = (2 | 7) + 1 & b;
var d = x > 5 && y < 6 || z == 7;
} | internal void Calculate()
{
var x = 12 - 3 % 4 * 12;
var y = 9 >> 12 + x - 1 << 2 + 1 & 6 + 4 * 12 - 1;
var z = (2 | 7) + 1 & y;
var a = 12 - 3 % 4 * 12;
var b = 9 >> 12 + a - 1 << 2 + 1 & 6 + 4 * 12 - 1;
var c = (2 | 7) + 1 & b;
var d = x > 5 && y < 6 || z == 7;
} |
Before formatting | After formatting, relational |
---|---|
void Calculate()
{
var x = 12 - ((3 % 4) * 12);
var y = ((9 >> ((12 + x) - 1)) << (2 + 1)) & ((6 + (4 * 12)) - 1);
var z = ((2 | 7) + 1) & y;
var a = 12 - 3 % 4 * 12;
var b = 9 >> 12 + a - 1 << 2 + 1 & 6 + 4 * 12 - 1;
var c = (2 | 7) + 1 & b;
var d = x > 5 && y < 6 || z == 7;
} | internal void Calculate()
{
var x = 12 - 3 % 4 * 12;
var y = 9 >> 12 + x - 1 << 2 + 1 & 6 + 4 * 12 - 1;
var z = (2 | 7) + 1 & y;
var a = 12 - 3 % 4 * 12;
var b = 9 >> 12 + a - 1 << 2 + 1 & 6 + 4 * 12 - 1;
var c = (2 | 7) + 1 & b;
var d = x > 5 && y < 6 || z == 7;
} |
Before formatting | After formatting, shift |
---|---|
void Calculate()
{
var x = 12 - ((3 % 4) * 12);
var y = ((9 >> ((12 + x) - 1)) << (2 + 1)) & ((6 + (4 * 12)) - 1);
var z = ((2 | 7) + 1) & y;
var a = 12 - 3 % 4 * 12;
var b = 9 >> 12 + a - 1 << 2 + 1 & 6 + 4 * 12 - 1;
var c = (2 | 7) + 1 & b;
var d = x > 5 && y < 6 || z == 7;
} | internal void Calculate()
{
var x = 12 - 3 % 4 * 12;
var y = (9 >> (12 + x - 1)) << (2 + 1) & 6 + 4 * 12 - 1;
var z = (2 | 7) + 1 & y;
var a = 12 - 3 % 4 * 12;
var b = (9 >> (12 + a - 1)) << (2 + 1) & 6 + 4 * 12 - 1;
var c = (2 | 7) + 1 & b;
var d = x > 5 && y < 6 || z == 7;
} |
Before formatting | After formatting, arithmetic |
---|---|
void Calculate()
{
var x = 12 - ((3 % 4) * 12);
var y = ((9 >> ((12 + x) - 1)) << (2 + 1)) & ((6 + (4 * 12)) - 1);
var z = ((2 | 7) + 1) & y;
var a = 12 - 3 % 4 * 12;
var b = 9 >> 12 + a - 1 << 2 + 1 & 6 + 4 * 12 - 1;
var c = (2 | 7) + 1 & b;
var d = x > 5 && y < 6 || z == 7;
} | internal void Calculate()
{
var x = 12 - ((3 % 4) * 12);
var y = 9 >> (12 + x) - 1 << 2 + 1 & (6 + (4 * 12)) - 1;
var z = (2 | 7) + 1 & y;
var a = 12 - ((3 % 4) * 12);
var b = 9 >> (12 + a) - 1 << 2 + 1 & (6 + (4 * 12)) - 1;
var c = (2 | 7) + 1 & b;
var d = x > 5 && y < 6 || z == 7;
} |
Before formatting | After formatting, additive |
---|---|
void Calculate()
{
var x = 12 - ((3 % 4) * 12);
var y = ((9 >> ((12 + x) - 1)) << (2 + 1)) & ((6 + (4 * 12)) - 1);
var z = ((2 | 7) + 1) & y;
var a = 12 - 3 % 4 * 12;
var b = 9 >> 12 + a - 1 << 2 + 1 & 6 + 4 * 12 - 1;
var c = (2 | 7) + 1 & b;
var d = x > 5 && y < 6 || z == 7;
} | internal void Calculate()
{
var x = 12 - (3 % 4 * 12);
var y = 9 >> (12 + x) - 1 << 2 + 1 & (6 + (4 * 12)) - 1;
var z = (2 | 7) + 1 & y;
var a = 12 - (3 % 4 * 12);
var b = 9 >> (12 + a) - 1 << 2 + 1 & (6 + (4 * 12)) - 1;
var c = (2 | 7) + 1 & b;
var d = x > 5 && y < 6 || z == 7;
} |
Before formatting | After formatting, multiplicative |
---|---|
void Calculate()
{
var x = 12 - ((3 % 4) * 12);
var y = ((9 >> ((12 + x) - 1)) << (2 + 1)) & ((6 + (4 * 12)) - 1);
var z = ((2 | 7) + 1) & y;
var a = 12 - 3 % 4 * 12;
var b = 9 >> 12 + a - 1 << 2 + 1 & 6 + 4 * 12 - 1;
var c = (2 | 7) + 1 & b;
var d = x > 5 && y < 6 || z == 7;
} | internal void Calculate()
{
var x = 12 - (3 % 4) * 12;
var y = 9 >> 12 + x - 1 << 2 + 1 & 6 + 4 * 12 - 1;
var z = (2 | 7) + 1 & y;
var a = 12 - (3 % 4) * 12;
var b = 9 >> 12 + a - 1 << 2 + 1 & 6 + 4 * 12 - 1;
var c = (2 | 7) + 1 & b;
var d = x > 5 && y < 6 || z == 7;
} |
Before formatting | After formatting, bitwise_and |
---|---|
void Calculate()
{
var x = 12 - ((3 % 4) * 12);
var y = ((9 >> ((12 + x) - 1)) << (2 + 1)) & ((6 + (4 * 12)) - 1);
var z = ((2 | 7) + 1) & y;
var a = 12 - 3 % 4 * 12;
var b = 9 >> 12 + a - 1 << 2 + 1 & 6 + 4 * 12 - 1;
var c = (2 | 7) + 1 & b;
var d = x > 5 && y < 6 || z == 7;
} | internal void Calculate()
{
var x = 12 - 3 % 4 * 12;
var y = (9 >> 12 + x - 1 << 2 + 1) & (6 + 4 * 12 - 1);
var z = ((2 | 7) + 1) & y;
var a = 12 - 3 % 4 * 12;
var b = (9 >> 12 + a - 1 << 2 + 1) & (6 + 4 * 12 - 1);
var c = ((2 | 7) + 1) & b;
var d = x > 5 && y < 6 || z == 7;
} |
When the operations from the following groups are nested
Property names:
[resharper_]csharp_parentheses_group_non_obvious_operations
, [resharper_]parentheses_group_non_obvious_operations
Possible values:
none
arithmetic
: * / % + - << >> & ^ |relational
: < > <= >= == !=conditional
: && || ??
Examples:
Before formatting | After formatting, none |
---|---|
void Calculate()
{
var x = 12 - ((3 % 4) * 12);
var y = ((9 >> ((12 + x) - 1)) << (2 + 1)) & ((6 + (4 * 12)) - 1);
var z = ((2 | 7) + 1) & y;
var a = 12 - 3 % 4 * 12;
var b = 9 >> 12 + a - 1 << 2 + 1 & 6 + 4 * 12 - 1;
var c = (2 | 7) + 1 & b;
var d = x > 5 && y < 6 || z == 7;
var e = x > 6 != y > 6 && x != null == (y != null);
} | internal void Calculate()
{
var x = 12 - 3 % 4 * 12;
var y = ((9 >> (12 + x - 1)) << (2 + 1)) & (6 + 4 * 12 - 1);
var z = ((2 | 7) + 1) & y;
var a = 12 - 3 % 4 * 12;
var b = ((9 >> (12 + a - 1)) << (2 + 1)) & (6 + 4 * 12 - 1);
var c = ((2 | 7) + 1) & b;
var d = x > 5 && y < 6 || z == 7;
var e = x > 6 != y > 6 && x != null == (y != null);
} |
Before formatting | After formatting, arithmetic |
---|---|
void Calculate()
{
var x = 12 - ((3 % 4) * 12);
var y = ((9 >> ((12 + x) - 1)) << (2 + 1)) & ((6 + (4 * 12)) - 1);
var z = ((2 | 7) + 1) & y;
var a = 12 - 3 % 4 * 12;
var b = 9 >> 12 + a - 1 << 2 + 1 & 6 + 4 * 12 - 1;
var c = (2 | 7) + 1 & b;
var d = x > 5 && y < 6 || z == 7;
var e = x > 6 != y > 6 && x != null == (y != null);
} | internal void Calculate()
{
var x = 12 - (3 % 4 * 12);
var y = ((9 >> (12 + x - 1)) << (2 + 1)) & (6 + (4 * 12) - 1);
var z = ((2 | 7) + 1) & y;
var a = 12 - (3 % 4 * 12);
var b = ((9 >> (12 + a - 1)) << (2 + 1)) & (6 + (4 * 12) - 1);
var c = ((2 | 7) + 1) & b;
var d = x > 5 && y < 6 || z == 7;
var e = x > 6 != y > 6 && x != null == (y != null);
} |
Before formatting | After formatting, relational |
---|---|
void Calculate()
{
var x = 12 - ((3 % 4) * 12);
var y = ((9 >> ((12 + x) - 1)) << (2 + 1)) & ((6 + (4 * 12)) - 1);
var z = ((2 | 7) + 1) & y;
var a = 12 - 3 % 4 * 12;
var b = 9 >> 12 + a - 1 << 2 + 1 & 6 + 4 * 12 - 1;
var c = (2 | 7) + 1 & b;
var d = x > 5 && y < 6 || z == 7;
var e = x > 6 != y > 6 && x != null == (y != null);
} | internal void Calculate()
{
var x = 12 - 3 % 4 * 12;
var y = ((9 >> (12 + x - 1)) << (2 + 1)) & (6 + 4 * 12 - 1);
var z = ((2 | 7) + 1) & y;
var a = 12 - 3 % 4 * 12;
var b = ((9 >> (12 + a - 1)) << (2 + 1)) & (6 + 4 * 12 - 1);
var c = ((2 | 7) + 1) & b;
var d = x > 5 && y < 6 || z == 7;
var e = (x > 6) != (y > 6) && x != null == (y != null);
} |
Before formatting | After formatting, conditional |
---|---|
void Calculate()
{
var x = 12 - ((3 % 4) * 12);
var y = ((9 >> ((12 + x) - 1)) << (2 + 1)) & ((6 + (4 * 12)) - 1);
var z = ((2 | 7) + 1) & y;
var a = 12 - 3 % 4 * 12;
var b = 9 >> 12 + a - 1 << 2 + 1 & 6 + 4 * 12 - 1;
var c = (2 | 7) + 1 & b;
var d = x > 5 && y < 6 || z == 7;
var e = x > 6 != y > 6 && x != null == (y != null);
} | internal void Calculate()
{
var x = 12 - 3 % 4 * 12;
var y = ((9 >> (12 + x - 1)) << (2 + 1)) & (6 + 4 * 12 - 1);
var z = ((2 | 7) + 1) & y;
var a = 12 - 3 % 4 * 12;
var b = ((9 >> (12 + a - 1)) << (2 + 1)) & (6 + 4 * 12 - 1);
var c = ((2 | 7) + 1) & b;
var d = (x > 5 && y < 6) || z == 7;
var e = x > 6 != y > 6 && x != null == (y != null);
} |
Even when operations of the same type are nested
Property names:
[resharper_]csharp_parentheses_same_type_operations
, [resharper_]parentheses_same_type_operations
Possible values:
true | false
Examples:
true |
---|
internal void Calculate()
{
var x = 5 + 3 - 2 * 3 / 4;
var e = x != null == (y != null);
} |
false |
---|
internal void Calculate()
{
var x = 5 + 3 - 2 * 3 / 4;
var e = x != null == (y != null);
} |
Braces
In "if" statement
Property names:
[resharper_]csharp_braces_for_ifelse
, [resharper_]braces_for_ifelse
Possible values:
not_required
: Do not enforcenot_required_for_both
: Enforce if any part requires bracesrequired
: Enforce alwaysrequired_for_multiline
: Enforce if body is multi-linerequired_for_multiline_statement
: Enforce if statement is multi-line
Examples:
Before formatting | After formatting, not_required |
---|---|
public void Preview(int a, int b)
{
int c;
if (a > b)
{
c = a * b;
}
else if (a == b)
c = a + b;
else
{
c = a / b;
}
} | public void Preview(int a, int b)
{
int c;
if (a > b)
c = a * b;
else if (a == b)
c = a + b;
else
c = a / b;
} |
Before formatting | After formatting, not_required_for_both |
---|---|
public void Preview(int a, int b)
{
int c;
if (a > b)
{
c = a * b;
}
else if (a == b)
c = a + b;
else
{
c = a / b;
}
} | public void Preview(int a, int b)
{
int c;
if (a > b)
c = a * b;
else if (a == b)
c = a + b;
else
c = a / b;
} |
Before formatting | After formatting, required |
---|---|
public void Preview(int a, int b)
{
int c;
if (a > b)
{
c = a * b;
}
else if (a == b)
c = a + b;
else
{
c = a / b;
}
} | public void Preview(int a, int b)
{
int c;
if (a > b)
{
c = a * b;
}
else if (a == b)
{
c = a + b;
}
else
{
c = a / b;
}
} |
Before formatting | After formatting, required_for_multiline |
---|---|
public void Preview(int a, int b)
{
int c;
if (a > b)
{
c = a * b;
}
else if (a == b)
c = a + b;
else
{
c = a / b;
}
} | public void Preview(int a, int b)
{
int c;
if (a > b)
c = a * b;
else if (a == b)
c = a + b;
else
c = a / b;
} |
Before formatting | After formatting, required_for_multiline_statement |
---|---|
public void Preview(int a, int b)
{
int c;
if (a > b)
{
c = a * b;
}
else if (a == b)
c = a + b;
else
{
c = a / b;
}
} | public void Preview(int a, int b)
{
int c;
if (a > b)
{
c = a * b;
}
else if (a == b)
{
c = a + b;
}
else
{
c = a / b;
}
} |
In "for" statement
Property names:
[resharper_]csharp_braces_for_for
, [resharper_]braces_for_for
Possible values:
not_required
: Do not enforcerequired
: Enforce alwaysrequired_for_multiline
: Enforce if body is multi-linerequired_for_multiline_statement
: Enforce if statement is multi-line
Examples:
Before formatting | After formatting, not_required |
---|---|
public void Preview(int a, int b)
{
var c = 0;
for (var i = a; i < b; i++)
c += System.Linq.Enumerable.Range(i, a + b).Sum();
for (var i = a; i < b; i++)
{
c += System.Linq.Enumerable
.Range(i, a + b)
.Sum();
}
} | public void Preview(int a, int b)
{
var c = 0;
for (var i = a; i < b; i++)
c += System.Linq.Enumerable.Range(i, a + b).Sum();
for (var i = a; i < b; i++)
c += System.Linq.Enumerable
.Range(i, a + b)
.Sum();
} |
Before formatting | After formatting, required |
---|---|
public void Preview(int a, int b)
{
var c = 0;
for (var i = a; i < b; i++)
c += System.Linq.Enumerable.Range(i, a + b).Sum();
for (var i = a; i < b; i++)
{
c += System.Linq.Enumerable
.Range(i, a + b)
.Sum();
}
} | public void Preview(int a, int b)
{
var c = 0;
for (var i = a; i < b; i++)
{
c += System.Linq.Enumerable.Range(i, a + b).Sum();
}
for (var i = a; i < b; i++)
{
c += System.Linq.Enumerable
.Range(i, a + b)
.Sum();
}
} |
Before formatting | After formatting, required_for_multiline |
---|---|
public void Preview(int a, int b)
{
var c = 0;
for (var i = a; i < b; i++)
c += System.Linq.Enumerable.Range(i, a + b).Sum();
for (var i = a; i < b; i++)
{
c += System.Linq.Enumerable
.Range(i, a + b)
.Sum();
}
} | public void Preview(int a, int b)
{
var c = 0;
for (var i = a; i < b; i++)
c += System.Linq.Enumerable.Range(i, a + b).Sum();
for (var i = a; i < b; i++)
{
c += System.Linq.Enumerable
.Range(i, a + b)
.Sum();
}
} |
Before formatting | After formatting, required_for_multiline_statement |
---|---|
public void Preview(int a, int b)
{
var c = 0;
for (var i = a; i < b; i++)
c += System.Linq.Enumerable.Range(i, a + b).Sum();
for (var i = a; i < b; i++)
{
c += System.Linq.Enumerable
.Range(i, a + b)
.Sum();
}
} | public void Preview(int a, int b)
{
var c = 0;
for (var i = a; i < b; i++)
{
c += System.Linq.Enumerable.Range(i, a + b).Sum();
}
for (var i = a; i < b; i++)
{
c += System.Linq.Enumerable
.Range(i, a + b)
.Sum();
}
} |
In "foreach" statement
Property names:
[resharper_]csharp_braces_for_foreach
, [resharper_]braces_for_foreach
Possible values:
not_required
: Do not enforcerequired
: Enforce alwaysrequired_for_multiline
: Enforce if body is multi-linerequired_for_multiline_statement
: Enforce if statement is multi-line
Examples:
Before formatting | After formatting, not_required |
---|---|
public void Preview(int a, int b)
{
var c = 0;
foreach (var num in System.Linq.Enumerable.Range(a, b))
c += System.Linq.Enumerable.Range(a, b).Sum();
foreach (var num in System.Linq.Enumerable.Range(a, b))
{
c += System.Linq.Enumerable
.Range(a, b)
.Sum();
}
} | public void Preview(int a, int b)
{
var c = 0;
foreach (var num in System.Linq.Enumerable.Range(a, b))
c += System.Linq.Enumerable.Range(a, b).Sum();
foreach (var num in System.Linq.Enumerable.Range(a, b))
c += System.Linq.Enumerable
.Range(a, b)
.Sum();
} |
Before formatting | After formatting, required |
---|---|
public void Preview(int a, int b)
{
var c = 0;
foreach (var num in System.Linq.Enumerable.Range(a, b))
c += System.Linq.Enumerable.Range(a, b).Sum();
foreach (var num in System.Linq.Enumerable.Range(a, b))
{
c += System.Linq.Enumerable
.Range(a, b)
.Sum();
}
} | public void Preview(int a, int b)
{
var c = 0;
foreach (var num in System.Linq.Enumerable.Range(a, b))
{
c += System.Linq.Enumerable.Range(a, b).Sum();
}
foreach (var num in System.Linq.Enumerable.Range(a, b))
{
c += System.Linq.Enumerable
.Range(a, b)
.Sum();
}
} |
Before formatting | After formatting, required_for_multiline |
---|---|
public void Preview(int a, int b)
{
var c = 0;
foreach (var num in System.Linq.Enumerable.Range(a, b))
c += System.Linq.Enumerable.Range(a, b).Sum();
foreach (var num in System.Linq.Enumerable.Range(a, b))
{
c += System.Linq.Enumerable
.Range(a, b)
.Sum();
}
} | public void Preview(int a, int b)
{
var c = 0;
foreach (var num in System.Linq.Enumerable.Range(a, b))
c += System.Linq.Enumerable.Range(a, b).Sum();
foreach (var num in System.Linq.Enumerable.Range(a, b))
{
c += System.Linq.Enumerable
.Range(a, b)
.Sum();
}
} |
Before formatting | After formatting, required_for_multiline_statement |
---|---|
public void Preview(int a, int b)
{
var c = 0;
foreach (var num in System.Linq.Enumerable.Range(a, b))
c += System.Linq.Enumerable.Range(a, b).Sum();
foreach (var num in System.Linq.Enumerable.Range(a, b))
{
c += System.Linq.Enumerable
.Range(a, b)
.Sum();
}
} | public void Preview(int a, int b)
{
var c = 0;
foreach (var num in System.Linq.Enumerable.Range(a, b))
{
c += System.Linq.Enumerable.Range(a, b).Sum();
}
foreach (var num in System.Linq.Enumerable.Range(a, b))
{
c += System.Linq.Enumerable
.Range(a, b)
.Sum();
}
} |
In "while" statement
Property names:
[resharper_]csharp_braces_for_while
, [resharper_]braces_for_while
Possible values:
not_required
: Do not enforcerequired
: Enforce alwaysrequired_for_multiline
: Enforce if body is multi-linerequired_for_multiline_statement
: Enforce if statement is multi-line
Examples:
Before formatting | After formatting, not_required |
---|---|
public void Preview(int a, int b)
{
while (a > b)
b += System.Linq.Enumerable.Range(a, b).Sum();
while (a > b)
{
b += System.Linq.Enumerable
.Range(a, b)
.Sum();
}
} | public void Preview(int a, int b)
{
while (a > b)
b += System.Linq.Enumerable.Range(a, b).Sum();
while (a > b)
b += System.Linq.Enumerable
.Range(a, b)
.Sum();
} |
Before formatting | After formatting, required |
---|---|
public void Preview(int a, int b)
{
while (a > b)
b += System.Linq.Enumerable.Range(a, b).Sum();
while (a > b)
{
b += System.Linq.Enumerable
.Range(a, b)
.Sum();
}
} | public void Preview(int a, int b)
{
while (a > b)
{
b += System.Linq.Enumerable.Range(a, b).Sum();
}
while (a > b)
{
b += System.Linq.Enumerable
.Range(a, b)
.Sum();
}
} |
Before formatting | After formatting, required_for_multiline |
---|---|
public void Preview(int a, int b)
{
while (a > b)
b += System.Linq.Enumerable.Range(a, b).Sum();
while (a > b)
{
b += System.Linq.Enumerable
.Range(a, b)
.Sum();
}
} | public void Preview(int a, int b)
{
while (a > b)
b += System.Linq.Enumerable.Range(a, b).Sum();
while (a > b)
{
b += System.Linq.Enumerable
.Range(a, b)
.Sum();
}
} |
Before formatting | After formatting, required_for_multiline_statement |
---|---|
public void Preview(int a, int b)
{
while (a > b)
b += System.Linq.Enumerable.Range(a, b).Sum();
while (a > b)
{
b += System.Linq.Enumerable
.Range(a, b)
.Sum();
}
} | public void Preview(int a, int b)
{
while (a > b)
{
b += System.Linq.Enumerable.Range(a, b).Sum();
}
while (a > b)
{
b += System.Linq.Enumerable
.Range(a, b)
.Sum();
}
} |
In "do-while" statement
Property names:
[resharper_]csharp_braces_for_dowhile
, [resharper_]braces_for_dowhile
Possible values:
not_required
: Do not enforcerequired
: Enforce alwaysrequired_for_multiline
: Enforce if body is multi-linerequired_for_multiline_statement
: Enforce if statement is multi-line
Examples:
Before formatting | After formatting, not_required |
---|---|
public void Preview(int a, int b)
{
do
b += System.Linq.Enumerable.Range(a, b).Sum();
while (a > b);
do
{
b += System.Linq.Enumerable
.Range(a, b)
.Sum();
} while (a > b);
} | public void Preview(int a, int b)
{
do
b += System.Linq.Enumerable.Range(a, b).Sum();
while (a > b);
do
b += System.Linq.Enumerable
.Range(a, b)
.Sum();
while (a > b);
} |
Before formatting | After formatting, required |
---|---|
public void Preview(int a, int b)
{
do
b += System.Linq.Enumerable.Range(a, b).Sum();
while (a > b);
do
{
b += System.Linq.Enumerable
.Range(a, b)
.Sum();
} while (a > b);
} | public void Preview(int a, int b)
{
do
{
b += System.Linq.Enumerable.Range(a, b).Sum();
} while (a > b);
do
{
b += System.Linq.Enumerable
.Range(a, b)
.Sum();
} while (a > b);
} |
Before formatting | After formatting, required_for_multiline |
---|---|
public void Preview(int a, int b)
{
do
b += System.Linq.Enumerable.Range(a, b).Sum();
while (a > b);
do
{
b += System.Linq.Enumerable
.Range(a, b)
.Sum();
} while (a > b);
} | public void Preview(int a, int b)
{
do
b += System.Linq.Enumerable.Range(a, b).Sum();
while (a > b);
do
{
b += System.Linq.Enumerable
.Range(a, b)
.Sum();
} while (a > b);
} |
Before formatting | After formatting, required_for_multiline_statement |
---|---|
public void Preview(int a, int b)
{
do
b += System.Linq.Enumerable.Range(a, b).Sum();
while (a > b);
do
{
b += System.Linq.Enumerable
.Range(a, b)
.Sum();
} while (a > b);
} | public void Preview(int a, int b)
{
do
{
b += System.Linq.Enumerable.Range(a, b).Sum();
} while (a > b);
do
{
b += System.Linq.Enumerable
.Range(a, b)
.Sum();
} while (a > b);
} |
In "using" statement
Property names:
[resharper_]csharp_braces_for_using
, [resharper_]braces_for_using
Possible values:
not_required
: Do not enforcerequired
: Enforce alwaysrequired_for_multiline
: Enforce if body is multi-linerequired_for_multiline_statement
: Enforce if statement is multi-line
Examples:
Before formatting | After formatting, not_required |
---|---|
public void Preview(System.IDisposable disposable)
{
var c = 0;
using (disposable)
c += System.Linq.Enumerable.Range(1, 42).Sum()
for (var i = a; i < b; i++)
{
c += System.Linq.Enumerable
.Range(1, 42)
.Sum();
}
} | public void Preview(System.IDisposable disposable)
{
var c = 0;
using (disposable)
c += System.Linq.Enumerable.Range(1, 42).Sum()
for (var i = a; i < b; i++)
c += System.Linq.Enumerable
.Range(1, 42)
.Sum();
} |
Before formatting | After formatting, required |
---|---|
public void Preview(System.IDisposable disposable)
{
var c = 0;
using (disposable)
c += System.Linq.Enumerable.Range(1, 42).Sum()
for (var i = a; i < b; i++)
{
c += System.Linq.Enumerable
.Range(1, 42)
.Sum();
}
} | public void Preview(System.IDisposable disposable)
{
var c = 0;
using (disposable)
{
c += System.Linq.Enumerable.Range(1, 42).Sum()
}
for (var i = a; i < b; i++)
c += System.Linq.Enumerable
.Range(1, 42)
.Sum();
} |
Before formatting | After formatting, required_for_multiline |
---|---|
public void Preview(System.IDisposable disposable)
{
var c = 0;
using (disposable)
c += System.Linq.Enumerable.Range(1, 42).Sum()
for (var i = a; i < b; i++)
{
c += System.Linq.Enumerable
.Range(1, 42)
.Sum();
}
} | public void Preview(System.IDisposable disposable)
{
var c = 0;
using (disposable)
c += System.Linq.Enumerable.Range(1, 42).Sum()
for (var i = a; i < b; i++)
c += System.Linq.Enumerable
.Range(1, 42)
.Sum();
} |
Before formatting | After formatting, required_for_multiline_statement |
---|---|
public void Preview(System.IDisposable disposable)
{
var c = 0;
using (disposable)
c += System.Linq.Enumerable.Range(1, 42).Sum()
for (var i = a; i < b; i++)
{
c += System.Linq.Enumerable
.Range(1, 42)
.Sum();
}
} | public void Preview(System.IDisposable disposable)
{
var c = 0;
using (disposable)
{
c += System.Linq.Enumerable.Range(1, 42).Sum()
}
for (var i = a; i < b; i++)
c += System.Linq.Enumerable
.Range(1, 42)
.Sum();
} |
In "lock" statement
Property names:
[resharper_]csharp_braces_for_lock
, [resharper_]braces_for_lock
Possible values:
not_required
: Do not enforcerequired
: Enforce alwaysrequired_for_multiline
: Enforce if body is multi-linerequired_for_multiline_statement
: Enforce if statement is multi-line
Examples:
Before formatting | After formatting, not_required |
---|---|
public void Preview(object lockObject)
{
var c = 0;
lock (lockObject)
c += System.Linq.Enumerable.Range(1, 42).Sum()
lock (lockObject)
{
c += System.Linq.Enumerable
.Range(1, 42)
.Sum();
}
} | public void Preview(object lockObject)
{
var c = 0;
lock (lockObject)
c += System.Linq.Enumerable.Range(1, 42).Sum()
lock (lockObject)
c += System.Linq.Enumerable
.Range(1, 42)
.Sum();
} |
Before formatting | After formatting, required |
---|---|
public void Preview(object lockObject)
{
var c = 0;
lock (lockObject)
c += System.Linq.Enumerable.Range(1, 42).Sum()
lock (lockObject)
{
c += System.Linq.Enumerable
.Range(1, 42)
.Sum();
}
} | public void Preview(object lockObject)
{
var c = 0;
lock (lockObject)
{
c += System.Linq.Enumerable.Range(1, 42).Sum()
}
lock (lockObject)
{
c += System.Linq.Enumerable
.Range(1, 42)
.Sum();
}
} |
Before formatting | After formatting, required_for_multiline |
---|---|
public void Preview(object lockObject)
{
var c = 0;
lock (lockObject)
c += System.Linq.Enumerable.Range(1, 42).Sum()
lock (lockObject)
{
c += System.Linq.Enumerable
.Range(1, 42)
.Sum();
}
} | public void Preview(object lockObject)
{
var c = 0;
lock (lockObject)
c += System.Linq.Enumerable.Range(1, 42).Sum()
lock (lockObject)
{
c += System.Linq.Enumerable
.Range(1, 42)
.Sum();
}
} |
Before formatting | After formatting, required_for_multiline_statement |
---|---|
public void Preview(object lockObject)
{
var c = 0;
lock (lockObject)
c += System.Linq.Enumerable.Range(1, 42).Sum()
lock (lockObject)
{
c += System.Linq.Enumerable
.Range(1, 42)
.Sum();
}
} | public void Preview(object lockObject)
{
var c = 0;
lock (lockObject)
{
c += System.Linq.Enumerable.Range(1, 42).Sum()
}
lock (lockObject)
{
c += System.Linq.Enumerable
.Range(1, 42)
.Sum();
}
} |
In "fixed" statement
Property names:
[resharper_]csharp_braces_for_fixed
, [resharper_]braces_for_fixed
Possible values:
not_required
: Do not enforcerequired
: Enforce alwaysrequired_for_multiline
: Enforce if body is multi-linerequired_for_multiline_statement
: Enforce if statement is multi-line
Examples:
Before formatting | After formatting, not_required |
---|---|
public unsafe void Preview(string str)
{
var c = 0;
fixed (char* p = str)
p[42] = 'c';
fixed (char* p = str)
{
p[42]
=
'c';
}
} | public unsafe void Preview(string str)
{
var c = 0;
fixed (char* p = str)
p[42] = 'c';
fixed (char* p = str)
p[42]
=
'c';
} |
Before formatting | After formatting, required |
---|---|
public unsafe void Preview(string str)
{
var c = 0;
fixed (char* p = str)
p[42] = 'c';
fixed (char* p = str)
{
p[42]
=
'c';
}
} | public unsafe void Preview(string str)
{
var c = 0;
fixed (char* p = str)
{
p[42] = 'c';
}
fixed (char* p = str)
{
p[42]
=
'c';
}
} |
Before formatting | After formatting, required_for_multiline |
---|---|
public unsafe void Preview(string str)
{
var c = 0;
fixed (char* p = str)
p[42] = 'c';
fixed (char* p = str)
{
p[42]
=
'c';
}
} | public unsafe void Preview(string str)
{
var c = 0;
fixed (char* p = str)
p[42] = 'c';
fixed (char* p = str)
{
p[42]
=
'c';
}
} |
Before formatting | After formatting, required_for_multiline_statement |
---|---|
public unsafe void Preview(string str)
{
var c = 0;
fixed (char* p = str)
p[42] = 'c';
fixed (char* p = str)
{
p[42]
=
'c';
}
} | public unsafe void Preview(string str)
{
var c = 0;
fixed (char* p = str)
{
p[42] = 'c';
}
fixed (char* p = str)
{
p[42]
=
'c';
}
} |
Remove redundant
Property names:
[resharper_]csharp_braces_redundant
, [resharper_]braces_redundant
Possible values:
true | false
Code body
Methods and operators
Property names:
[resharper_]csharp_method_or_operator_body
, [resharper_]method_or_operator_body
Possible values:
expression_body
: Expression bodyblock_body
: Block body
Examples:
Before formatting | After formatting, expression_body |
---|---|
class Preview
{
int Add(int a, int b)
{
return a + b;
}
void SideEffect(DB db)
{
Drop(db);
}
static bool operator true(Preview p)
{
return false;
}
} | internal class Preview
{
private int Add(int a, int b) => a + b;
private void SideEffect(DB db)
{
Drop(db);
}
static bool operator true(Preview p) => false;
} |
Before formatting | After formatting, block_body |
---|---|
class Preview
{
int Add(int a, int b)
{
return a + b;
}
void SideEffect(DB db)
{
Drop(db);
}
static bool operator true(Preview p)
{
return false;
}
} | internal class Preview
{
private int Add(int a, int b)
{
return a + b;
}
private void SideEffect(DB db)
{
Drop(db);
}
static bool operator true(Preview p)
{
return false;
}
} |
Local functions
Property names:
[resharper_]csharp_local_function_body
, [resharper_]local_function_body
Possible values:
expression_body
: Expression bodyblock_body
: Block body
Examples:
Before formatting | After formatting, expression_body |
---|---|
class Demo
{
public void Preview()
{
int CalculateTheAnswer()
{
return 42;
}
int answer = CalculateTheAnswer();
Output(answer);
}
} | internal class Demo
{
public void Preview()
{
int CalculateTheAnswer() => 42;
var answer = CalculateTheAnswer();
Output(answer);
}
} |
Before formatting | After formatting, block_body |
---|---|
class Demo
{
public void Preview()
{
int CalculateTheAnswer()
{
return 42;
}
int answer = CalculateTheAnswer();
Output(answer);
}
} | internal class Demo
{
public void Preview()
{
int CalculateTheAnswer()
{
return 42;
}
var answer = CalculateTheAnswer();
Output(answer);
}
} |
Constructors and destructors
Property names:
[resharper_]csharp_constructor_or_destructor_body
, [resharper_]constructor_or_destructor_body
Possible values:
expression_body
: Expression bodyblock_body
: Block body
Examples:
Before formatting | After formatting, expression_body |
---|---|
class Preview
{
public Preview(string message)
{
Message = message;
}
~Preview()
{
throw new Exception();
}
} | internal class Preview
{
public Preview(string message) => Message = message;
~Preview() => throw new Exception();
} |
Before formatting | After formatting, block_body |
---|---|
class Preview
{
public Preview(string message)
{
Message = message;
}
~Preview()
{
throw new Exception();
}
} | internal class Preview
{
public Preview(string message)
{
Message = message;
}
~Preview()
{
throw new Exception();
}
} |
Properties, indexers and events
Property names:
[resharper_]csharp_accessor_owner_body
, [resharper_]accessor_owner_body
Possible values:
expression_body
: Expression bodyaccessors_with_expression_body
: Accessors with expression bodyaccessors_with_block_body
: Accessors with block body
Examples:
Before formatting | After formatting, expression_body |
---|---|
class Preview
{
int PropertyA
{
get { return field; }
set { field = value; }
}
int PropertyB => field;
int this[int i]
{
get { return array[i]; }
set { array[i] = value; }
}
event EventHandler MissionComplete
{
add { action += value; }
remove { action -= value; }
}
} | internal class Preview
{
private int PropertyA
{
get => field;
set => field = value;
}
private int PropertyB => field;
private int this[int i]
{
get => array[i];
set => array[i] = value;
}
private event EventHandler MissionComplete
{
add => action += value;
remove => action -= value;
}
} |
Before formatting | After formatting, accessors_with_expression_body |
---|---|
class Preview
{
int PropertyA
{
get { return field; }
set { field = value; }
}
int PropertyB => field;
int this[int i]
{
get { return array[i]; }
set { array[i] = value; }
}
event EventHandler MissionComplete
{
add { action += value; }
remove { action -= value; }
}
} | internal class Preview
{
private int PropertyA
{
get => field;
set => field = value;
}
private int PropertyB
{
get => field;
}
private int this[int i]
{
get => array[i];
set => array[i] = value;
}
private event EventHandler MissionComplete
{
add => action += value;
remove => action -= value;
}
} |
Before formatting | After formatting, accessors_with_block_body |
---|---|
class Preview
{
int PropertyA
{
get { return field; }
set { field = value; }
}
int PropertyB => field;
int this[int i]
{
get { return array[i]; }
set { array[i] = value; }
}
event EventHandler MissionComplete
{
add { action += value; }
remove { action -= value; }
}
} | internal class Preview
{
private int PropertyA
{
get { return field; }
set { field = value; }
}
private int PropertyB
{
get { return field; }
}
private int this[int i]
{
get { return array[i]; }
set { array[i] = value; }
}
private event EventHandler MissionComplete
{
add { action += value; }
remove { action -= value; }
}
} |
Apply style heuristics
Property names:
[resharper_]csharp_use_heuristics_for_body_style
, [resharper_]use_heuristics_for_body_style
Possible values:
true | false
Examples:
Before formatting | After formatting, true |
---|---|
class Preview
{
void VoidReturningMethod(DB db)
{
Drop(db);
}
int Assignment(int value)
{
return Property = value;
}
Action ReturnStatementBodiedLambda()
{
return () => { Foo(); };
}
} | internal class Preview
{
private void VoidReturningMethod(DB db)
{
Drop(db);
}
private int Assignment(int value)
{
return Property = value;
}
private Action ReturnStatementBodiedLambda()
{
return () => { Foo(); };
}
} |
Before formatting | After formatting, false |
---|---|
class Preview
{
void VoidReturningMethod(DB db)
{
Drop(db);
}
int Assignment(int value)
{
return Property = value;
}
Action ReturnStatementBodiedLambda()
{
return () => { Foo(); };
}
} | internal class Preview
{
private void VoidReturningMethod(DB db)
{
Drop(db);
}
private int Assignment(int value)
{
return Property = value;
}
private Action ReturnStatementBodiedLambda()
{
return () => { Foo(); };
}
} |
Attributes
Join or separate attributes in section
Property names:
[resharper_]csharp_force_attribute_style
, [resharper_]force_attribute_style
Possible values:
join
: Joinseparate
: Separate
Examples:
Before formatting | After formatting, join |
---|---|
namespace N
{
[Attr1, Attr2]
[Attr3]
class C { }
} | namespace N
{
[Attr1, Attr2, Attr3]
internal class C { }
} |
Before formatting | After formatting, separate |
---|---|
namespace N
{
[Attr1, Attr2]
[Attr3]
class C { }
} | namespace N
{
[Attr1]
[Attr2]
[Attr3]
internal class C { }
} |
Trailing comma
Before a new line in multiline lists
Property names:
[resharper_]csharp_trailing_comma_in_multiline_lists
, [resharper_]trailing_comma_in_multiline_lists
Possible values:
true | false
Examples:
true |
---|
var myArray = new[]
{
item1,
item2,
} |
false |
---|
var myArray = new[]
{
item1,
item2
} |
When the last element is not followed by a new line
Property names:
[resharper_]csharp_trailing_comma_in_singleline_lists
, [resharper_]trailing_comma_in_singleline_lists
Possible values:
true | false
Examples:
true |
---|
internal var myArray = new[] { item1, item2, } |
false |
---|
internal var myArray = new[] { item1, item2 } |
Object creation
When created type is evident from usage
Property names:
[resharper_]csharp_object_creation_when_type_evident
, [resharper_]object_creation_when_type_evident
Possible values:
target_typed
: Omit type: 'new()'explicitly_typed
: Specify type: 'new T()'
When created type is not evident from usage
Property names:
[resharper_]csharp_object_creation_when_type_not_evident
, [resharper_]object_creation_when_type_not_evident
Possible values:
target_typed
: Omit type: 'new()'explicitly_typed
: Specify type: 'new T()'
Default value
When type is evident from usage
Property names:
[resharper_]csharp_default_value_when_type_evident
, [resharper_]default_value_when_type_evident
Possible values:
default_literal
: Omit type: 'default'default_expression
: Specify type: 'default(T)'
When type is not evident from usage
Property names:
[resharper_]csharp_default_value_when_type_not_evident
, [resharper_]default_value_when_type_not_evident
Possible values:
default_literal
: Omit type: 'default'default_expression
: Specify type: 'default(T)'