Code Analysis ReferenceAnalyzersRCS1221On this pageRCS1221: Use pattern matching instead of combination of 'as' operator and null checkPropertiesPropertyValueDefault SeverityInfoMinimum language version7.0ExamplesExample #1diagnostic.csvar y = x as Foo;if (y == null){ return;}fix.csif (!(x is Foo y)){ return;}Applies toExtension for VS 2022Extension for VS CodeExtension for Open VSXPackage Roslynator.Analyzers