Skip to content

Latest commit

 

History

History
59 lines (40 loc) · 709 Bytes

RCS1199.md

File metadata and controls

59 lines (40 loc) · 709 Bytes

RCS1199: Unnecessary null check

Property Value
Id RCS1199
Category Redundancy
Severity Info

Examples

Code with Diagnostic

bool? x = null;

// ...

if (x.HasValue && x.Value) // RCS1199
{
}

Code with Fix

if (x == true)
{
}

Code with Diagnostic

bool? x = null;
bool y = false;

// ...

if (x != null && x.Value == y) // RCS1199
{
}

Code with Fix

if (x == y)
{
}

See Also

(Generated with DotMarkdown)