public DateRangeLister(DateTime minimum, DateTime maximum, DateTimeUnit unit)
            : base(minimum, maximum)
        {
            switch (unit)
            {
            case DateTimeUnit.Year:
                _count        = (int)Maximum.Years(Minimum);
                _getNextValue = () =>
                {
                    if (Index < 0)
                    {
                        return(Minimum);
                    }
                    if (Index >= _count - 1)
                    {
                        return(null);
                    }
                    if (Minimum.TryAddYears(Index + 1, out DateTime result))
                    {
                        return(result);
                    }
                    return(null);
                };
                break;

            case DateTimeUnit.Month:
                _count        = (int)Maximum.Months(Minimum).NotAbove(int.MaxValue);
                _getNextValue = () =>
                {
                    if (Index < 0)
                    {
                        return(Minimum);
                    }
                    if (Index >= _count - 1)
                    {
                        return(null);
                    }
                    if (Minimum.TryAddMonths(Index + 1, out DateTime result))
                    {
                        return(result);
                    }
                    return(null);
                };
                break;

            case DateTimeUnit.Hour:
                _count        = (int)Maximum.Hours(Minimum).NotAbove(int.MaxValue);
                _getNextValue = () =>
                {
                    if (Index < 0)
                    {
                        return(Minimum);
                    }
                    if (Index >= _count - 1)
                    {
                        return(null);
                    }
                    if (Minimum.TryAddHours(Index + 1, out DateTime result))
                    {
                        return(result);
                    }
                    return(null);
                };
                break;

            case DateTimeUnit.Minute:
                _count        = (int)Maximum.Minutes(Minimum).NotAbove(int.MaxValue);
                _getNextValue = () =>
                {
                    if (Index < 0)
                    {
                        return(Minimum);
                    }
                    if (Index >= _count - 1)
                    {
                        return(null);
                    }
                    if (Minimum.TryAddMinutes(Index + 1, out DateTime result))
                    {
                        return(result);
                    }
                    return(null);
                };
                break;

            case DateTimeUnit.Second:
                _count        = (int)Maximum.Seconds(Minimum).NotAbove(int.MaxValue);
                _getNextValue = () =>
                {
                    if (Index < 0)
                    {
                        return(Minimum);
                    }
                    if (Index >= _count - 1)
                    {
                        return(null);
                    }
                    if (Minimum.TryAddSeconds(Index + 1, out DateTime result))
                    {
                        return(result);
                    }
                    return(null);
                };
                break;

            case DateTimeUnit.Millisecond:
                _count        = (int)Maximum.Milliseconds(Minimum).NotAbove(int.MaxValue);
                _getNextValue = () =>
                {
                    if (Index < 0)
                    {
                        return(Minimum);
                    }
                    if (Index >= _count - 1)
                    {
                        return(null);
                    }
                    if (Minimum.TryAddMilliseconds(Index + 1, out DateTime result))
                    {
                        return(result);
                    }
                    return(null);
                };
                break;

            default:                     // default to add day
                _count        = (int)Maximum.Days(Minimum).NotAbove(int.MaxValue);
                _getNextValue = () =>
                {
                    if (Index < 0)
                    {
                        return(Minimum);
                    }
                    if (Index >= _count - 1)
                    {
                        return(null);
                    }
                    if (Minimum.TryAddDays(Index + 1, out DateTime result))
                    {
                        return(result);
                    }
                    return(null);
                };
                break;
            }
        }