IComparable extensions

Date: 2023-11-06

public static class ComparableExtensions
{
    public static bool IsGreaterThan<T>(this T value, T other) where T : IComparable => value.CompareTo(other) > 0;

    public static bool IsLessThan<T>(this T value, T other) where T : IComparable => value.CompareTo(other) < 0;

    public static bool IsBetween<T>(this T value, T min, T max) where T : IComparable => value.CompareTo(min) >= 0 && value.CompareTo(max) <= 0;
}
80920cookie-checkIComparable extensions