Is there between DateTime in C# ? I know I can do simple check with if (a > date1 && a < date2) but I was trying to find Between meth
if (a > date1 && a < date2)
Between
This way is fast and the parameters are reversible:
public static bool BetweenInclusive(this DateTime value, DateTime a, DateTime b) { return ((a <= value) && (value <= b)) || ((b <= value) && (value <= a)); }