C#

C#

Made by DeepSource

Value types should not be compared using object.ReferenceEquals() CS-W1053

Bug risk
Critical

ReferenceEquals() method operates on objects, also known as reference types. Passing value types to it causes them to be boxed. In such cases, the return value is always false and unreliable. It is therefore recommended that you either rely on operators such as == and != or the object.Equals() method.

Bad Practice

var eq = object.ReferenceEquals(intA, intB);

Recommended

var eq = intA == intB;

Reference