ReSharper 2026.1 Help

Code inspection: Use null check pattern instead of a type check succeeding on any not-null value

This inspection reports patterns with an explicit type check that do not add useful type information because the checked value is already known to have that type whenever it is not null. In that case, a null check pattern is clearer than repeating the same type check.

Example

void M(string s) { switch (s) { case string _: break; } }
void M(string s) { switch (s) { case not null: break; } }

Quick-fix

Replace the explicit type check with a not null pattern.

01 April 2026