Pages

Thursday, April 19, 2007

Reference equality, bitwise equality and value equality

Reference equality means the object references that are compared refer to the same object.

Bitwise equality means the objects that are compared have the same binary representation.

Value equality means the compared objects have the same value even though they have different binary representations. For example, consider two Decimal objects that represent the numbers 1.10 and 1.1000. The Decimal objects do not have bitwise equality because they have different binary representations to account for the different number of trailing zeroes. However, the objects have value equality because the numbers 1.10 and 1.1000 are considered equal for comparison purposes since the trailing zeroes are insignificant.

Further reference : http://msdn2.microsoft.com/en-us/library/bsc2ak47.aspx

No comments: