public static List <DateOnly> GetLastXWorkingDays(this DateOnly thisDate, int x = 1, NonWorkingDays?nonWorkingDays = null) { if (x < 1) { throw new ArgumentOutOfRangeException(nameof(x), x, $"{nameof(x)} should be gte 1"); } var days = new List <DateOnly>(); for (int i = 1; i <= x; i++) { days.Add(thisDate.GetXthWorkingDay(i, startFromEnd: true, nonWorkingDays)); } return(days); }