+The default equality comparer, `EqualityComparer<Object>.Default.Equals`, considers two `NaN` values to be equal. However, in some cases, you may want the comparison of `NaN` values for equality to return `false`, which indicates that the values cannot be compared. The following example defines a `NanComparer` class that implements the <xref:System.Collections.IEqualityComparer> interface. It is used by the third example as an argument to the <xref:System.Collections.IStructuralEquatable.Equals(System.Object,System.Collections.IEqualityComparer)> method of the <xref:System.Collections.IStructuralEquatable> interface that tuples implement. It compares two <xref:System.Double> or two <xref:System.Single> values by using the equality operator. It passes values of any other type to the default equality comparer.
0 commit comments