Code inspection: Type check for nullable type is equal to underlying type check
This inspection reports a nullable type mark in an is type test when the ? does not change the result of the pattern. Removing it makes the check clearer.
Example
void Check<TStruct>(object obj) where TStruct : struct
{
if (obj is TStruct?)
{
Use();
}
}
void Check<TStruct>(object obj) where TStruct : struct
{
if (obj is TStruct)
{
Use();
}
}
Quick-fix
The quick-fix removes the redundant ? from the type test.
13 April 2026