Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

struct System.​IComparable

Assembly: System.Runtime

Defines a generalized type-specific comparison method that a value type or class implements to order or sort its instances.

Methods

public int
CompareTo​(object obj)
obj An object to compare with this instance.
Returns A value that indicates the relative order of the objects being compared. The return value has these meanings: <list type="table"> <listheader> <term> Value</term> <description> Meaning</description> </listheader> <item> <term> Less than zero</term> <description> This instance precedes <paramref name="obj" /> in the sort order.</description> </item> <item> <term> Zero</term> <description> This instance occurs in the same position in the sort order as <paramref name="obj" />.</description> </item> <item> <term> Greater than zero</term> <description> This instance follows <paramref name="obj" /> in the sort order.</description> </item> </list>
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.