我有以下代码来获取月份名称列表:
var monthNames = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.MonthNames;
出于某种原因,这会不断返回一个额外的空字符串值以及月份名称:
我正在使用 Xamarin Studio。其他人以前遇到过这种情况吗?
最佳答案
有些日历像 TaiwanLunisolarCalendar
或 KoreanLunisolarCalendar
有 13 个月。
在 12 个月的日历中,数组的第 13 个元素是一个空字符串。
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 forInvariantInfo
contains"January"
,"February"
,"March"
,"April"
,"May"
,"June"
,"July"
,"August"
,"September"
,"October"
,"November"
,"December"
, and""
.
关于c# - .Net CultureInfo Month Names 返回一个额外的空字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34079337/