What does the interface IStructuralComparable do in C#?


The IStructuralComparable interface supports the structural comparison of collection objects. This interface introduced in .NET 4.The following is the syntax −

public interface IStructuralComparable

It has a single method −

  • CompareTo(Object, IComparer) − It determines whether the current collection object precedes, occurs in the same position as, or follows another object in the sort order.

The compareTo() method determines whether the current collection object is less than, equal to, or greater than the second object in the sort order.

Explicit implementations for the IStructuralComparable Interface is provided by −

  • Generic tuple classes (Tuple<T1>, Tuple<T1,T2>, Tuple<T1,T2,T3>,…
  • Array class

Samual Sam
Samual Sam

Learning faster. Every day.

Updated on: 20-Jun-2020

119 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements