JetBrains Rider 2024.1 Help

Code Inspection: Assignment in conditional expression

Category

Potential Code Quality Issues

ID

AssignmentInConditionalExpression

EditorConfig

resharper_assignment_in_conditional_expression_highlighting

Default severity

Warning

Language

C#

Requires SWA

No

Comparison operators in a conditional expression are used much more often than assignment operators.

JetBrains Rider assumes that you probably intended to test the identity of the operands, and suggests that you replace the assignment operator = with the equality operator ==.

if (y = x) { }
if (y == x) { }
Last modified: 17 April 2024