Skip to main content

RCS1068: Simplify logical negation

Properties

PropertyValue
Default SeverityInfo
Minimum language version-

Examples

Example #1

diagnostic.cs
bool f = !true;
fix.cs
bool f = false;

Example #2

diagnostic.cs
bool f = !!f2;
fix.cs
bool f = f2;

Example #3

diagnostic.cs
bool f = !items.Any(s => !string.IsNullOrEmpty(s));
fix.cs
bool f = items.All(s => string.IsNullOrEmpty(s));

Applies to