See Also: IStructuralEquatable Members
Structural equality means that two objects are equal because they have equal values. It differs from reference equality, which indicates that two object references are equal because they reference the same physical object. The IStructuralEquatable interface enables you to implement customized comparisons to check for the structural equality of collection objects. That is, you can create your own definition of structural equality and specify that this definition be used with a collection type that accepts the IStructuralEquatable interface. The interface has two members: IStructuralEquatable.Equals(object, IEqualityComparer), which tests for equality by using a specified IEqualityComparer implementation, and IStructuralEquatable.GetHashCode(IEqualityComparer), which returns identical hash codes for objects that are equal.
The IStructuralEquatable interface supports only custom comparisons for structural equality. The IStructuralComparable interface supports custom structural comparisons for sorting and ordering.
The .NET Framework also provides default equality comparers, which are returned by the EqualityComparer`1.Default and StructuralComparisons.StructuralEqualityComparer properties. For more information, see the example.
The generic tuple classes (Tuple`1, Tuple`2, Tuple`3, and so on) and the Array class provide explicit implementations of the IStructuralEquatable interface. By casting (in C#) or converting (in Visual Basic) the current instance of an array or tuple to an IStructuralEquatable interface value and providing your IEqualityComparer implementation as an argument to the IStructuralEquatable.Equals(object, IEqualityComparer) method, you can define a custom equality comparison for the array or collection.