Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

How to get an array of months in c#

var months = new string[12]; 
for (var month = 1; month <= 12; month++)
{
	var firstDay = new DateTime(DateTime.Now.Year, month, 1);
  	var name = firstDay.ToString("MMMM", CultureInfo.CreateSpecificCulture("en"));
  	months[month - 1] = name;
}

foreach (var month in months) 
{
	Console.WriteLine($"-> {month}");
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: get time from datetime c# 
Csharp :: c# compile code at runtime 
Csharp :: c# inline if 
Csharp :: c# create a zip files 
:: know to which direction Vector.MoveTowards is moving unity 2D 
Csharp ::  
Csharp :: c# wpf change label text color 
Csharp :: loop through string array c# 
Csharp :: swaggergen add service not getting info in .net core 
Csharp :: make folder with c# 
Csharp :: convert comma separated string to array c# 
Csharp :: c# string to variable name 
Csharp :: javascript close page after 5 seconds 
Csharp :: cannot convert from string to type T 
Csharp :: convert string into double in c# 
Csharp :: how to do time.deltatime in c# 
Csharp :: dialog box with form flutter 
Csharp :: random.range unity not working 
Csharp :: c# combobox selected item 
Csharp :: get last 4 character c# 
Csharp :: c# array to string 
Csharp :: rotate player unity 
Csharp :: asp.net file detect mime type 
Csharp :: press key run code unity c# 
Csharp :: fade image out unity 
Csharp :: unity get parent object 
Csharp :: c# run cmd hidden 
Csharp :: how to look around with mouse in unity 
Csharp :: c# razor add disabled to button if 
Csharp :: parsing string to int c# 
ADD CONTENT
Topic
Content
Source link
Name
4+7 =