.Net CultureInfo Month Names returning an extra em

2019-04-05 02:56发布

I have the following code to get a list of Month names:

var monthNames = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.MonthNames;

For some reason, this keeps returning an additional empty string value along with the Month names:

enter image description here

I am using Xamarin Studio. Anyone else encounter this before?

1条回答
一纸荒年 Trace。
2楼-- · 2019-04-05 03:16

Some calendars like TaiwanLunisolarCalendar or KoreanLunisolarCalendar have 13 months.

In a 12-month calendar, the 13th element of the array is an empty string.

DateTimeFormatInfo.MonthNames
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 "".

查看更多
登录 后发表回答