Thursday February 11th

Wednesday February 10th

0 Kicks

Implementing Object Comparison

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.

0 comments

Commenting on Stories is limited for now and will open up to those recommended by the community. Learn how
Loading DotNetKicks...
brought to you by the Kicks Network