All rules
IDE0047Language rules (parentheses preferences)

Add parentheses for clarity

Add parentheses for clarity

Microsoft docs
Documented together with IDE0048Add parentheses for clarity

Description

The style rules in this section concern parentheses preferences, including the use of parentheses to clarify precedence for arithmetic, relational, and other binary operators.

Example

// dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity
var v = a + (b * c);

// dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary
var v = a + b * c;

Configurable options

Vote for the value each option should take in the generated .editorconfig.

dotnet_style_parentheses_in_arithmetic_binary_operators
default: always_for_clarity
dotnet_style_parentheses_in_relational_binary_operators
default: always_for_clarity
dotnet_style_parentheses_in_other_binary_operators
default: always_for_clarity
dotnet_style_parentheses_in_other_operators
default: never_if_unnecessary
Group results
0 yes 0 no
ConsensusNone (disabled)
Severity preference (yes voters)
Suggestion0
Warning0
Error0