ReSharper 2026.1 Help

Code inspection: Redundant conditional ternary expression usage

This inspection reports a conditional expression whose true and false branches only mirror the condition. In that case, the ternary expression can be replaced with the condition itself or its negation.

Example

class C { bool IsValid(bool condition) { return condition ? true : false; } }
class C { bool IsValid(bool condition) { return condition; } }

Quick-fix

The quick-fix replaces the ternary expression with the condition itself. When the branches are reversed, the quick-fix simplifies the expression to !condition.

13 April 2026