So I'm using MetroCombobox and I'm trying populate it with abbreviated month names but I'm getting an extra member at the bottom of the list.
This is my code:
var months = System.Globalization.DateTimeFormatInfo.InvariantInfo.AbbreviatedMonthNames;
mcbxGreenCardMonth.DataSource = months;
I don't understand why is it generating an extra member! Can someone tell me why and how can i get rid of it?
DateTimeFormatInfo.MonthNames
returns the 13th element of the array is an empty string.Try this,
var months = System.Globalization.DateTimeFormatInfo.InvariantInfo.AbbreviatedMonthNames;
comboBox1.DataSource = months.Where(s => !string.IsNullOrWhiteSpace(s)).ToList();