Code inspection: Check for reference equality instead
This inspection reports negated System.Type.Equals instance calls that should be written as reference inequality checks.
For System.Type, inequality is clearer when written with != instead of negating .Equals(...).
Example
using System;
bool AreDifferent(Type left, Type right)
{
return !left.Equals(right);
}
using System;
bool AreDifferent(Type left, Type right)
{
return left != right;
}
Quick-fix
A quick-fix helps you replace !left.Equals(right) with left != right.
27 March 2026