DateTimeFormatInfo.MonthNames 屬性

定義

取得或設定包含特定文化特性之月份完整名稱的一維陣列 (型別為 String)。Gets or sets a one-dimensional array of type String containing the culture-specific full names of the months.

public:
 property cli::array <System::String ^> ^ MonthNames { cli::array <System::String ^> ^ get(); void set(cli::array <System::String ^> ^ value); };
public string[] MonthNames { get; set; }
member this.MonthNames : string[] with get, set
Public Property MonthNames As String()

屬性值

String[]

包含特定文化特性之月份完整名稱的一維陣列 (型別為 String)。A one-dimensional array of type String containing the culture-specific full names of the months. 在 12 月制曆法中,陣列的第 13 個元素為空字串。In a 12-month calendar, the 13th element of the array is an empty string. InvariantInfo 的陣列包含 "January"、"February"、"March"、"April"、"May"、"June"、"July"、"August"、"September"、"October"、"November"、"December" 和 ""。The array for InvariantInfo contains "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", and "".

例外狀況

正在將屬性設定為 nullThe property is being set to null.

正在將屬性設定為多維或長度不是剛好為 13 的陣列。The property is being set to an array that is multidimensional or that has a length that is not exactly 13.

正在設定屬性,而且 DateTimeFormatInfo 物件為唯讀。The property is being set and the DateTimeFormatInfo object is read-only.

備註

當設定這個屬性時,陣列必須是一維,而且必須只有13個元素。When this property is set, the array must be one-dimensional and must have exactly 13 elements. Calendar物件會容納13個月的行事曆。Calendar objects accommodate calendars with 13 months. 第一個元素(位於索引零的元素)代表Calendar屬性所定義之年份的第一個月。The first element (the element at index zero) represents the first month of the year defined by the Calendar property.

如果您設定了MonthNames屬性,也必須MonthGenitiveNames設定屬性。If you set the MonthNames property, you must also set the MonthGenitiveNames property.

如果自訂模式包含格式模式 "mmmm",會DateTime.ToString顯示的MonthNames值,以取代格式模式中的 "MMMM"。If the custom pattern includes the format pattern "MMMM", DateTime.ToString displays the value of MonthNames in place of the "MMMM" in the format pattern.

如果Calendar屬性的值變更,這個屬性會受到影響。This property is affected if the value of the Calendar property changes.

適用於

另請參閱