コード例 #1
0
 internal string internalGetMonthName(int month, MonthNameStyles style, bool abbreviated)
 {
     string[] strArray;
       switch (style)
       {
     case MonthNameStyles.Genitive:
       strArray = this.internalGetGenitiveMonthNames(abbreviated);
       break;
     case MonthNameStyles.LeapYear:
       strArray = this.internalGetLeapYearMonthNames();
       break;
     default:
       strArray = abbreviated ? this.internalGetAbbreviatedMonthNames() : this.internalGetMonthNames();
       break;
       }
       if (month >= 1 && month <= strArray.Length)
     return strArray[month - 1];
       throw new ArgumentOutOfRangeException("month", Environment.GetResourceString("ArgumentOutOfRange_Range", (object) 1, (object) strArray.Length));
 }
コード例 #2
0
 //
 //  internalGetMonthName
 //
 // Actions: Return the month name using the specified MonthNameStyles in either abbreviated form
 //      or full form.
 // Arguments:
 //      month
 //      style           To indicate a form like regular/genitive/month name in a leap year.
 //      abbreviated     When true, return abbreviated form.  Otherwise, return a full form.
 //  Exceptions:
 //      ArgumentOutOfRangeException When month name is invalid.
 //
 internal String internalGetMonthName(int month, MonthNameStyles style, bool abbreviated) {
     //
     // Right now, style is mutual exclusive, but I make the style to be flag so that
     // maybe we can combine flag if there is such a need.
     //
     String[] monthNamesArray = null;
     switch (style) {
         case MonthNameStyles.Genitive:
             monthNamesArray = internalGetGenitiveMonthNames(abbreviated);
             break;
         case MonthNameStyles.LeapYear:
             monthNamesArray = internalGetLeapYearMonthNames(/*abbreviated*/);
             break;
         default:
             monthNamesArray = (abbreviated ? internalGetAbbreviatedMonthNames(): internalGetMonthNames());
             break;
     }
     // The month range is from 1 ~ this.m_monthNames.Length
     // (actually is 13 right now for all cases)
     if ((month < 1) || (month > monthNamesArray.Length)) {
         throw new ArgumentOutOfRangeException(
             "month", Environment.GetResourceString("ArgumentOutOfRange_Range",
             1, monthNamesArray.Length));
     }
     return (monthNamesArray[month-1]);
 }
コード例 #3
0
        internal string internalGetMonthName(int month, MonthNameStyles style, bool abbreviated)
        {
            string[] strArray = null;
            switch (style)
            {
                case MonthNameStyles.Genitive:
                    strArray = this.internalGetGenitiveMonthNames(abbreviated);
                    break;

                case MonthNameStyles.LeapYear:
                    strArray = this.internalGetLeapYearMonthNames();
                    break;

                default:
                    strArray = abbreviated ? this.GetAbbreviatedMonthNames() : this.GetMonthNames();
                    break;
            }
            if ((month < 1) || (month > strArray.Length))
            {
                throw new ArgumentOutOfRangeException("month", string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("ArgumentOutOfRange_Range"), new object[] { 1, strArray.Length }));
            }
            return strArray[month - 1];
        }