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 
Csharp :: know to which direction Vector.MoveTowards is moving unity 2D 
Csharp :: c# get all the column names from datagridview 
Csharp :: if unity 
Csharp :: c# get enum value from string 
Csharp :: enum get all values c# 
Csharp :: selenium open chrome c# 
Csharp :: c# listbox delete selected items 
Csharp :: c# run loop x times 
Csharp :: c# find process by name 
Csharp :: how to print hello world in c# 
Csharp :: c# file directory selection 
Csharp :: copy 2d arrays C# 
Csharp :: check if animation is playing unity 
Csharp :: how to set rigidbody velocity in unity 
Csharp :: read embedded resource c# xml 
Csharp :: c# merging two arrays 
Csharp :: httpclient post c# example 
Csharp :: rotate player unity 2d left and right 
Csharp :: c# use hashtable check if key exists 
Csharp :: c# sum of list 
Csharp :: c# optional parameters 
Csharp :: how to make colliders collide with some things but not other in unity 
Csharp :: remove adjacent duplicate characters 
Csharp :: C# function return datareader 
Csharp :: split string on last element 
Csharp :: string to byte array c# 
ADD CONTENT
Topic
Content
Source link
Name
3+6 =