Invert LINQ method call
| Property | Value |
|---|---|
| Id | RR0116 |
| Applicable Syntax | System.Linq.Enumerable.Any(Func<T, bool>) or System.Linq.Enumerable.All(Func<T, bool>) |
| Syntax Span | method 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