Click or drag to resize
AlgorithmsLexicographicalCompareT Method (IEnumerableT, IEnumerableT, IComparerT)
Performs a lexicographical comparison of two sequences of values, using a supplied comparer interface. 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.Collections
Assembly: X3Platform.Support (in X3Platform.Support.dll) Version: 1.0.0.0 (2.0.0.0)
Syntax
public static int LexicographicalCompare<T>(
	IEnumerable<T> sequence1,
	IEnumerable<T> sequence2,
	IComparer<T> comparer
)

Parameters

sequence1
Type: System.Collections.GenericIEnumerableT
The first sequence to compare.
sequence2
Type: System.Collections.GenericIEnumerableT
The second sequence to compare.
comparer
Type: System.Collections.GenericIComparerT
The IComparer<T> used to compare items. Only the Compare member function of this interface is called.

Type Parameters

T
Types of items to compare.

Return Value

Type: Int32
Less 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
ExceptionCondition
ArgumentNullExceptionsequence1, sequence2, or comparer is null.
See Also