c# - .Net CultureInfo Month Names 返回一个额外的空字符串

标签 c# .net datetime xamarin cultureinfo

我有以下代码来获取月份名称列表:

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

出于某种原因,这会不断返回一个额外的空字符串值以及月份名称:

enter image description here

我正在使用 Xamarin Studio。其他人以前遇到过这种情况吗?

最佳答案

有些日历像 TaiwanLunisolarCalendarKoreanLunisolarCalendar有 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 for InvariantInfo 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/

相关文章:

c# - 不能在条件语句中声明局部变量

java - 如果 currentTime 位于两个特定时间戳之间

datetime - Python 绘图时间

c# - 为什么observablecollection初始化为null?

c# - 如何使用 TPL 和 TaskScheduler 编写单元测试

c# - 将匿名集合放入类中

c# - 无法添加对 ´ 的引用。程序集必须具有 dll 或 exe 扩展名才能被引用

c# - 重写同步代码以使用 TPL 时如何简化或包装异常

c# - 如何抑制/捕获 System.ObjectDisposedException?

c# - 使用 SqlDataReader 将 DateTime2 转换为 C# DateTime