IsInRange

public static bool IsInRange(this DateTime currentDate, DateTime beginDate, DateTime endDate)
{
    return ( currentDate >= beginDate && currentDate <= endDate );
}
Example:
var monday = DateTime.Now.ThisWeekMonday();
var friday = DateTime.Now.ThisWeekFriday();

If (DateTime.Now.IsInRange(monday, friday) {
    ...do something...
}

Description

Determines if a date is within a given date range

Details

Double click on the code to select all.

 

;