public static bool IsCompareToType(this IComparable value, IComparable otherValue, CompareToType compareToType) { switch (compareToType) { case CompareToType.Equals: return(value.IsEqualTo(otherValue)); case CompareToType.GreaterThan: return(value.IsGreaterThan(otherValue)); case CompareToType.GreaterThanOrEquals: return(value.IsGreaterThanOrEquals(otherValue)); case CompareToType.LessThan: return(value.IsLessThan(otherValue)); case CompareToType.LessThanOrEquals: return(value.IsLessThanOrEquals(otherValue)); } return(false); }
public static bool IsDifferentFrom(this IComparable first, object second) { return(!first.IsEqualTo(second)); }
/// <summary> /// Returns whether the specified instance of <see cref="IComparable"/> is greater than or equal to another specified instance of <see cref="IComparable"/> /// </summary> public static bool IsGreaterThanOrEqualTo(this IComparable comparable, IComparable other) => comparable.IsGreaterThan(other) || comparable.IsEqualTo(other);