Code inspection: Comparison to integral constant is useless
This inspection reports a comparison between an integral value and a constant that is outside the value range of the compared type. Such a comparison has a constant result and usually points to a mistake in the condition.
Example
class C
{
bool IsMatch(byte value)
{
return value == 1000;
}
}
Here byte can never be 1000, so the comparison is useless.
Quick-fix
There is no dedicated quick-fix for this inspection. The usual fix is to correct the constant, change the compared type, or remove the impossible condition.
13 April 2026