ReSharper 2026.1 Help

Code inspection: Convert 'as' expression type check and the following null check into negated pattern matching

This inspection reports a negated is check written as !(expr is pattern). Modern C# can express the same check more directly with is not, which is shorter and easier to read.

Example

if (!(o is C { Boo: var boo } c)) { }
if (o is not C { Boo: var boo } c) { }

Quick-fix

Replace the outer negation with a negated pattern.

30 March 2026