JetBrains Rider 2017.2 Help

Code Inspection: Assignment in conditional expression

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 ==.

Suboptimal codeAfter the quick-fix
if (y = x) { }
if (y == x) { }
Last modified: 17 November 2017

See Also