Freigeben über


DateTimeFormatInfo.MonthNames Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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

Namespace:  System.Globalization
Assembly:  mscorlib (in mscorlib.dll)

Syntax

'Declaration
Public Property MonthNames As String()
public string[] MonthNames { get; set; }

Property Value

Type: array<System.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

Exception Condition
ArgumentNullException

An attempt was made to set the property to nulla null reference (Nothing in Visual Basic).

ArgumentException

An attempt was made to set the property to a multidimensional array or to a single-dimensional array with a length that is not exactly 13.

InvalidOperationException

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.

If a custom date and time format string includes the "MMMM" format specifier, DateTime.ToString returns the appropriate element from the MonthNames property array in place of "MMMM" in the custom format string.

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

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.