StructuralComparisons.StructuralComparer Property

.NET Framework (current version)
 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets a predefined object that performs a structural comparison of two objects.

Namespace:   System.Collections
Assembly:  mscorlib (in mscorlib.dll)

Public Shared ReadOnly Property StructuralComparer As IComparer

Property Value

Type: System.Collections.IComparer

A predefined object that is used to perform a structural comparison of two collection objects.

When the IComparer object returned by this property is passed to the comparison method of a collection object, such as Array.IStructuralComparable.CompareTo(Object, IComparer) or Tuple(Of T1, T2, T3).IStructuralComparable.CompareTo(Object, IComparer), its Compare method is called for each member of an array or for each component of a tuple. This implementation of the Compare method behaves as follows when it compares each item of a collection object with the corresponding item of another collection object:

  • It considers two items that are null to be equal, and considers a null item to be less than an item that is not null.

  • If the first item in the comparison can be cast to an IStructuralComparable object (in other words, if it is a collection object that implements the IStructuralComparable interface), it calls the CompareTo method.

  • If the first item in the comparison cannot be cast to an IStructuralComparable object (in other words, if it is not a collection object that implements the IStructuralComparable interface), it calls the Comparer.Default.Compare method.

Universal Windows Platform
Available since 8
.NET Framework
Available since 4.0
Portable Class Library
Supported in: portable .NET platforms
Windows Phone Silverlight
Available since 8.0
Windows Phone
Available since 8.1
Return to top
Show: