AlgorithmsLexicographicalCompareT Method (IEnumerableT, IEnumerableT) |
Performs a lexicographical comparison of two sequences of values. A lexicographical comparison compares corresponding
pairs of elements from two sequences in order. If the first element of sequence1 is less than the first element of sequence2,
then the comparison ends and the first sequence is lexicographically less than the second. If the first elements of each sequence
are equal, then the comparison proceeds to the second element of each sequence. If one sequence is shorter than the other,
but corresponding elements are all equal, then the shorter sequence is considered less than the longer one.
Namespace: X3Platform.CollectionsAssembly: X3Platform.Support (in X3Platform.Support.dll) Version: 1.0.0.0 (2.0.0.0)
Syntaxpublic static int LexicographicalCompare<T>(
IEnumerable<T> sequence1,
IEnumerable<T> sequence2
)
where T : Object, IComparable<T>
public:
generic<typename T>
where T : Object, IComparable<T>
static int LexicographicalCompare(
IEnumerable<T>^ sequence1,
IEnumerable<T>^ sequence2
)
Parameters
- sequence1
- Type: System.Collections.GenericIEnumerableT
The first sequence to compare. - sequence2
- Type: System.Collections.GenericIEnumerableT
The second sequence to compare.
Type Parameters
- T
- Types of items to compare. This type must implement IComparable<T> to allow
items to be compared.
Return Value
Type:
Int32Less than zero if
sequence1 is lexicographically less than
sequence2.
Greater than zero if
sequence1 is lexicographically greater than
sequence2.
Zero if
sequence1 is equal to
sequence2.
Exceptions
RemarksT must implement either IComparable<T> and this implementation is used
to compare the items.
See Also