RCS1199: Unnecessary null check
Properties
Property | Value |
---|---|
Default Severity | Info |
Minimum language version | - |
Examples
Example #1
diagnostic.cs
bool? x = null;
// ...
if (x.HasValue && x.Value)
{
}
fix.cs
if (x == true)
{
}
Example #2
diagnostic.cs
bool? x = null;
bool y = false;
// ...
if (x != null && x.Value == y)
{
}
fix.cs
if (x == y)
{
}