Skip to main content

Invert LINQ method call

PropertyValue
IdRR0116
Applicable SyntaxSystem.Linq.Enumerable.Any(Func<T, bool>) or System.Linq.Enumerable.All(Func<T, bool>)
Syntax Spanmethod name
Enabled by Default

Usage

Example #1

before.cs
if (items.Any(predicate))
{
}
after.cs
if (items.All(!predicate))
{
}

Example #2

before.cs
if (items.All(predicate))
{
}
after.cs
if (items.Any(!predicate))
{
}

Configuration

roslynator_refactoring.invert_linq_method_call.enabled = true|false