public override IComparer <T> BuildSortComparer <T>(SortCriteria sortCriteria) #if DEBUG { return(sortCriteria == null ? throw new ArgumentNullException(nameof(sortCriteria)) : new DelegateComparer <T>(SortComparerFactory <T> .BuildComparerFunc(sortCriteria))); }
public static int CompareValueType(Thing x, Thing y) { int?valueX = ((SwampThing)x).License; int?valueY = ((SpaceThing)y).License; if (!SortComparerFactory.TryEnsureValidValues(valueX.HasValue, valueY.HasValue, out int valueComparisonResult)) { return(valueComparisonResult); } return(valueX.Value.CompareTo(valueY.Value)); }
public static int CompareReferenceType(Thing x) { string?valueX = x.Text; string?valueY = null; if (!SortComparerFactory.TryEnsureValidReferences(valueX, valueY, out int referenceComparisonResult)) { return(referenceComparisonResult); } return(valueX.CompareTo(valueY)); }
public static int CompareEnumType(Thing x, Thing y) { long?valueX = (long)x.Day; long?valueY = (long)y.Day; if (!SortComparerFactory.TryEnsureValidValues(valueX.HasValue, valueY.HasValue, out int valueComparisonResult)) { return(valueComparisonResult); } return(valueX.Value.CompareTo(valueY)); }
public static int CompareValueTypeNoGetter() { int?valueX = null; int?valueY = null; if (!SortComparerFactory.TryEnsureValidValues(valueX.HasValue, valueY.HasValue, out int valueComparisonResult)) { return(valueComparisonResult); } return(valueX.Value.CompareTo(valueY.Value)); }
public static int CompareValueBaseType(Thing x, Thing y) { int?valueX = x.Id; int?valueY = y.Id; if (!SortComparerFactory.TryEnsureValidValues(valueX.HasValue, valueY.HasValue, out int valueComparisonResult)) { return(valueComparisonResult); } return(valueX.Value.CompareTo(valueY.Value)); }
public int Compare(T x, T y) { return(!SortComparerFactory.TryEnsureValidReferences(x, y, out int referenceComparisonResult) ? referenceComparisonResult : _CompareFunc.Invoke(x, y)); }