Permalink
Fetching contributors…
Cannot retrieve contributors at this time
39 lines (28 sloc) 800 Bytes

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

Property Value
Id RCS1221
Category Usage
Default Severity Info
Enabled by Default
Supports Fade-Out -
Supports Fade-Out Analyzer -

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)