CompareTo Method
From Wintellect PowerCollections
[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]
Compares this pair to another pair of the some type. The pairs are compared by using the IComparable<T> or IComparable interface on TFirst and TSecond. The pairs are compared by their first elements first, if their first elements are equal, then they are compared by their second elements.
If either TFirst or TSecond does not implement IComparable<T> or IComparable, then an NotSupportedException is thrown, because the pairs cannot be compared.
Namespace: Wintellect.PowerCollections
Assembly:
PowerCollections (in PowerCollections.dll)
Syntax
| C# |
|---|
public int CompareTo( Pair<TFirst, TSecond> other ) |
| Visual Basic (Declaration) |
|---|
Public Function CompareTo ( _ other As Pair(Of TFirst, TSecond) _ ) As Integer |
| Visual C++ |
|---|
public: virtual int CompareTo ( Pair<TFirst, TSecond> other ) sealed |
Parameters
- other
- Pair<(Of <TFirst, TSecond>)>
The pair to compare to.
Return Value
An integer indicating how this pair compares to other. Less than zero indicates this pair is less than other. Zero indicate this pair is equals to other. Greater than zero indicates this pair is greater than other.
Exceptions
| Exception | Condition |
|---|---|
| System..::NotSupportedException | Either FirstSecond or TSecond is not comparable via the IComparable<T> or IComparable interfaces. |
See Also
Pair<(Of <TFirst, TSecond>)> Structure
Wintellect.PowerCollections Namespace