System.Globalization.PersianCalendar.CheckYearMonthRange C# (CSharp) Method

CheckYearMonthRange() private method

private CheckYearMonthRange ( int year, int month, int era ) : void
year int
month int
era int
return void
        internal void CheckYearMonthRange(int year, int month, int era) {
            CheckYearRange(year, era);
            if (year == MaxCalendarYear) {
                if (month > MaxCalendarMonth) {
                    throw new ArgumentOutOfRangeException(
                                "month",
                                String.Format(
                                    CultureInfo.CurrentCulture,
                                    Environment.GetResourceString("ArgumentOutOfRange_Range"),
                                    1,
                                    MaxCalendarMonth));
                }
            }

            if (month < 1 || month > 12) {
                throw new ArgumentOutOfRangeException("month", Environment.GetResourceString("ArgumentOutOfRange_Month"));
            }
        }

Usage Example

Example #1
0
        /// <summary>Returns the number of days in the specified month of the specified year and era.</summary>
        /// <param name="year">An integer from 1 through 9378 that represents the year. </param>
        /// <param name="month">An integer that represents the month, and ranges from 1 through 12 if <paramref name="year" /> is not 9378, or 1 through 10 if <paramref name="year" /> is 9378.</param>
        /// <param name="era">An integer from 0 through 1 that represents the era. </param>
        /// <returns>The number of days in the specified month of the specified year and era.</returns>
        /// <exception cref="T:System.ArgumentOutOfRangeException">
        ///         <paramref name="year" />, <paramref name="month" />, or <paramref name="era" /> is outside the range supported by this calendar. </exception>
        // Token: 0x06002F82 RID: 12162 RVA: 0x000B5D70 File Offset: 0x000B3F70
        public override int GetDaysInMonth(int year, int month, int era)
        {
            PersianCalendar.CheckYearMonthRange(year, month, era);
            if (month == 10 && year == 9378)
            {
                return(13);
            }
            int num = PersianCalendar.DaysToMonth[month] - PersianCalendar.DaysToMonth[month - 1];

            if (month == 12 && !this.IsLeapYear(year))
            {
                num--;
            }
            return(num);
        }
All Usage Examples Of System.Globalization.PersianCalendar::CheckYearMonthRange