แก้ไข

แชร์ผ่าน


DateTimeFormatInfo.MonthNames Property

Definition

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()

Property Value

String[]

A one-dimensional array of type String containing the culture-specific full names of the months. In a 12-month calendar, the 13th element of the array is an empty string. The array for InvariantInfo contains "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", and "".

Exceptions

The property is being set to null.

The property is being set to an array that is multidimensional or that has a length that is not exactly 13.

The property is being set and the DateTimeFormatInfo object is read-only.

Remarks

When this property is set, the array must be one-dimensional and must have exactly 13 elements. Calendar objects accommodate calendars with 13 months. The first element (the element at index zero) represents the first month of the year defined by the Calendar property.

If you set the MonthNames property, you must also set the MonthGenitiveNames property.

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.

This property is affected if the value of the Calendar property changes.

Applies to

See also