Skip to content

Latest commit

 

History

History
37 lines (26 loc) · 690 Bytes

RCS1221.md

File metadata and controls

37 lines (26 loc) · 690 Bytes

RCS1221: Use pattern matching instead of combination of 'as' operator and null check

Property Value
Id RCS1221
Category Usage
Severity Info
Minimal Language Version 7.0

Example

Code with Diagnostic

var y = x as Foo; // RCS1221

if (y == null)
{
    return;
}

Code with Fix

if (!(x is Foo y))
{
    return;
}

See Also

(Generated with DotMarkdown)