public int Compare( object[] firstValues, object[] secondValues) { if (firstValues.Length != isDescendingValues.Length || secondValues.Length != isDescendingValues.Length) { throw new ArgumentException("Incompatible size MultiKey sizes for comparison"); } for (var i = 0; i < firstValues.Length; i++) { var valueOne = firstValues[i]; var valueTwo = secondValues[i]; var isDescending = isDescendingValues[i]; if (!stringTypedValue[i]) { var comparisonResult = CompareValues(valueOne, valueTwo, isDescending); if (comparisonResult != 0) { return comparisonResult; } } else { var comparisonResult = CollectionUtil.CompareValuesCollated( valueOne, valueTwo, isDescending, collator); if (comparisonResult != 0) { return comparisonResult; } } } // Make the comparator compatible with equals if (!firstValues.Equals(secondValues)) { return -1; } return 0; }
public int Compare( object firstValue, object secondValue) { return(CollectionUtil.CompareValuesCollated(firstValue, secondValue, _isDescendingValue, _collator)); }