ComparableExtensions.IsBetween<T>

Extension Method in ComparableExtensions

Declaration

public static bool IsBetween<T>(this T value, T min, T max, bool includeMin = true, bool includeMax = true)
    where T : IComparable<T>

Description

Checks if the value is between a min and max value.

Type Parameters

TThe type of value to check.

Parameters

valueThe value to check.
minThe minimum value.
maxThe maximum value.
includeMinThe minimum value is inclusive if true, exclusive if false.
includeMaxThe maximum value is inclusive if true, exclusive if false.

Returns

boolTrue if the value is between the min and max value.