Permalink
Fetching contributors…
Cannot retrieve contributors at this time
59 lines (39 sloc) 1.04 KB

RCS1068: Simplify logical negation

Property Value
Id RCS1068
Category Simplification
Default Severity Info
Enabled by Default
Supports Fade-Out -
Supports Fade-Out Analyzer -

Examples

Code with Diagnostic

bool f = !true; // RCS1068

Code with Fix

bool f = false;

Code with Diagnostic

bool f = !!f2; // RCS1068

Code with Fix

bool f = f2;

Code with Diagnostic

bool f = !items.Any(s => !string.IsNullOrEmpty(s)); // RCS1068

Code with Fix

bool f = items.All(s => string.IsNullOrEmpty(s));

See Also

(Generated with DotMarkdown)