Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.Net CultureInfo Month Names returning an extra empty string

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?

like image 375
pnavk Avatar asked Dec 04 '15 01:12

pnavk


1 Answers

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

like image 171
Reza Aghaei Avatar answered Sep 16 '22 15:09

Reza Aghaei