Code inspection: Redundant boolean comparison
This inspection reports a boolean comparison or boolean pattern check that can be simplified. Comparing a bool to true or false, or matching it against a constant boolean pattern, usually adds syntax without adding meaning.
Example
class C
{
void M(bool flag)
{
if (flag == true)
{
}
}
}
class C
{
void M(bool flag)
{
if (flag)
{
}
}
}
Quick-fix
Depending on the original form, the quick-fix can also replace == false with !flag or remove a constant boolean pattern such as value is true.
13 April 2026