Skip to main content

RCS1104: Simplify conditional expression

Properties

PropertyValue
Default SeverityInfo
Minimum language version-

Examples

Example #1

diagnostic.cs
bool x = y ? true : false;
fix.cs
bool x = y;

Example #2

diagnostic.cs
bool x = y ? false : true;
fix.cs
bool x = !y;

Example #3

diagnostic.cs
bool x = y ? z : false;
fix.cs
bool x = y && z;

Example #4

diagnostic.cs
bool x = y ? true : z;
fix.cs
bool x = y || z;

Applies to