System.Globalization.Calendar.CheckAddResult C# (CSharp) Method

CheckAddResult() static private method

static private CheckAddResult ( long ticks, DateTime minValue, DateTime maxValue ) : void
ticks long
minValue DateTime
maxValue DateTime
return void
        internal static void CheckAddResult(long ticks, DateTime minValue, DateTime maxValue) {
            if (ticks < minValue.Ticks || ticks > maxValue.Ticks) {
                throw new ArgumentException(
                    String.Format(CultureInfo.InvariantCulture, Environment.GetResourceString("Argument_ResultCalendarRange"),
                        minValue, maxValue));
            }
        }

Usage Example

Esempio n. 1
0
        public override DateTime AddYears(DateTime time, int years)
        {
            int datePart = this.GetDatePart(time.Ticks, 0);
            int month    = this.GetDatePart(time.Ticks, 2);
            int day      = this.GetDatePart(time.Ticks, 3);

            datePart += years;
            this.CheckHebrewYearValue(datePart, 0, "years");
            int monthsInYear = this.GetMonthsInYear(datePart, 0);

            if (month > monthsInYear)
            {
                month = monthsInYear;
            }
            int daysInMonth = this.GetDaysInMonth(datePart, month);

            if (day > daysInMonth)
            {
                day = daysInMonth;
            }
            long ticks = this.ToDateTime(datePart, month, day, 0, 0, 0, 0).Ticks + (time.Ticks % 0xc92a69c000L);

            Calendar.CheckAddResult(ticks, this.MinSupportedDateTime, this.MaxSupportedDateTime);
            return(new DateTime(ticks));
        }
All Usage Examples Of System.Globalization.Calendar::CheckAddResult