ReSharper 2024.1 Help

Code inspection: Simplify negative equality expression

Category

Common Practices and Code Improvements

ID

NegativeEqualityExpression

EditorConfig

resharper_negative_equality_expression_highlighting

Default severity

Suggestion

Language

C#

Requires SWA

No

Negating an equality expression is, effectively, the same as ‘flipping’ the equality operator from == to != or the other way around. That way, if you write !(a == b), ReSharper will offer the option to change it to a != b.

Last modified: 11 February 2024