JetBrains Rider 2026.1 Help

Code inspection: Invert condition

This inspection reports a conditional expression that negates .Any(...) and keeps the branches in the original order.

That shape is usually clearer when written with the positive condition and swapped branches.

Example

var result = !items.Any() ? emptyValue : firstValue;
var result = items.Any() ? firstValue : emptyValue;

Quick-fix

Rewrites the expression by removing the negation from .Any(...) and swapping the ?: branches.

28 March 2026