Open Source Web Application Framework for ASP.NET Core
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

19 lines
753 B

namespace System
{
/// <summary>
/// Extension methods for <see cref="IComparable{T}"/>.
/// </summary>
public static class AbpComparableExtensions
{
/// <summary>
/// Checks a value is between a minimum and maximum value.
/// </summary>
/// <param name="value">The value to be checked</param>
/// <param name="minInclusiveValue">Minimum (inclusive) value</param>
/// <param name="maxInclusiveValue">Maximum (inclusive) value</param>
public static bool IsBetween<T>(this T value, T minInclusiveValue, T maxInclusiveValue) where T : IComparable<T>
{
return value.CompareTo(minInclusiveValue) >= 0 && value.CompareTo(maxInclusiveValue) <= 0;
}
}
}