public static bool Matches(this WeeksOfMonth Frequency, DateTime Date) { var ret = false; var Number = Date.Day - 1; var ActualFrequency = Order[Number / 7]; ret = Frequency.HasFlag(ActualFrequency); if (Frequency.HasFlag(WeeksOfMonth.Last)) { var NextWeek = Date.AddDays(7); if (NextWeek.Month != Date.Month) { ret = true; } } return(ret); }
public static List <WeeksOfMonth> GetValues(this WeeksOfMonth Flags) { var ret = new List <WeeksOfMonth>(); foreach (var item in Order) { if (Flags.HasFlag(item)) { ret.Add(item); } } return(ret); }