public static void BeLessOrEqual <T>(Func <T> argumentFunc, T upperLimit) where T : IComparable { if (ComparablePredicates.IsGreaterThan(argumentFunc(), upperLimit)) { var argument = argumentFunc.GetParameter(p => ComparablePredicates.IsGreaterThan(p, upperLimit)); throw new ArgumentException($"The argument '{argument.Name}' must not be greater than {upperLimit}.", argument.Name); } }
public static bool IsGreaterThan <T>(this T first, T second) where T : struct, IComparable { return(ComparablePredicates.IsGreaterThan(first, second)); }