System.Globalization.DateTimeFormatInfo.MonthNames Property

Gets or sets a one-dimensional array of type string containing the culture-specific full names of the months.

Syntax

public string[] MonthNames { get; set; }

Value

A one-dimensional array of type string containing the full names of the months. For cultures with 12-month calendars the 13th element of the array is an empty string.

Exceptions

TypeReason
ArgumentNullExceptionThe value specified for a set operation is a null reference.
ArgumentExceptionThe value specified for a set operation is not an array with exactly 13 elements.
InvalidOperationExceptionThe current instance is read-only and a set operation was attempted.

Remarks

When this property is set, the array must be one-dimensional and must have exactly 13 elements. System.Globalization.Calendar objects accommodate calendars with 13 months.

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

If the custom pattern includes the format pattern "MMMM", DateTime.ToString displays the value of DateTimeFormatInfo.MonthNames in place of the "MMMM" in the format pattern.

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

Requirements

Namespace: System.Globalization
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0