CheckEraRange() private method

private CheckEraRange ( int era ) : void
era int
return void
Beispiel #1
0
 private static void CheckHebrewYearValue(int y, int era, string varName)
 {
     HebrewCalendar.CheckEraRange(era);
     if (y > 5999 || y < 5343)
     {
         throw new ArgumentOutOfRangeException(varName, string.Format((IFormatProvider)CultureInfo.CurrentCulture, Environment.GetResourceString("ArgumentOutOfRange_Range"), (object)5343, (object)5999));
     }
 }
Beispiel #2
0
        /// <summary>返回指定纪元中指定年份的天数。</summary>
        /// <returns>指定纪元中指定年份的天数。</returns>
        /// <param name="year">表示年份的整数。</param>
        /// <param name="era">表示纪元的整数。指定 <see cref="F:System.Globalization.HebrewCalendar.HebrewEra" /> 或 HebrewCalendar.Eras[Calendar.CurrentEra]。</param>
        /// <exception cref="T:System.ArgumentOutOfRangeException">
        /// <paramref name="year" /> 或 <paramref name="era" /> 超出了当前 <see cref="T:System.Globalization.HebrewCalendar" /> 对象支持的范围。</exception>
        public override int GetDaysInYear(int year, int era)
        {
            HebrewCalendar.CheckEraRange(era);
            int hebrewYearType = HebrewCalendar.GetHebrewYearType(year, era);

            if (hebrewYearType < 4)
            {
                return(352 + hebrewYearType);
            }
            return(382 + (hebrewYearType - 3));
        }
Beispiel #3
0
        /// <summary>返回指定纪元中指定年份的指定月份的天数。</summary>
        /// <returns>指定纪元中指定年份的指定月份中的天数。</returns>
        /// <param name="year">表示年份的整数。</param>
        /// <param name="month">1 到 13 之间的一个整数,它表示月份。</param>
        /// <param name="era">表示纪元的整数。指定 <see cref="F:System.Globalization.HebrewCalendar.HebrewEra" /> 或 Calendar.Eras[Calendar.CurrentEra]。</param>
        /// <exception cref="T:System.ArgumentOutOfRangeException">
        /// <paramref name="year" />、<paramref name="month" /> 或 <paramref name="era" /> 超出了当前 <see cref="T:System.Globalization.HebrewCalendar" /> 对象支持的范围。</exception>
        public override int GetDaysInMonth(int year, int month, int era)
        {
            HebrewCalendar.CheckEraRange(era);
            int hebrewYearType = HebrewCalendar.GetHebrewYearType(year, era);

            this.CheckHebrewMonthValue(year, month, era);
            int num = HebrewCalendar.LunarMonthLen[hebrewYearType, month];

            if (num != 0)
            {
                return(num);
            }
            throw new ArgumentOutOfRangeException("month", Environment.GetResourceString("ArgumentOutOfRange_Month"));
        }