ReferenceEquals on value types (CA2013)
Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.
Key dotnet.codequality.reference-equals-value-type · Severity error · Category codequality
Microsoft analyzer CA2013. Flags object.ReferenceEquals on value types. Each side is boxed into a new object, so the result is always false.
Incorrect
Section titled “Incorrect”if (ReferenceEquals(orderId, otherId)) Merge();Correct
Section titled “Correct”if (orderId == otherId) Merge();