Error!
Success!

Implementing Object Comparison

0
kicks

Implementing Object Comparison  (Unpublished)

Comparison operators are often implemented poorly in .NET, in the sense that they contain duplicate code or perform certain checks, like a null reference test, multiple times. This article demonstrates a pattern that you can use to implement object comparison in a way that causes zero redundant code and achieves perfect efficiency (no comparison, not even a null check, is performed twice). It also provides a solution for comparison in inherited classes and integrates well with the == and != operators - all again without any redundant code and achieving optimal efficiency.


Kicked By:
Drop Kicked By: