At the moment I\'m creating a DateTime for each month and formatting it to only include the month.
Is there another or any better way to do this?
string[] monthNames = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.MonthNames;
foreach (string m in monthNames) // writing out
{
Console.WriteLine(m);
}
Output:
January
February
March
April
May
June
July
August
September
October
November
December
Update: Do note that for different locales/cultures, the output might not be in English. Haven't tested that before though.
For US English only:
string[] monthNames = (new System.Globalization.CultureInfo("en-US")).DateTimeFormat.MonthNames;