Example for 1D array in c#
- Two types of arrays in c#,1D array is the one type of array in c#.
// Main Method
public static void Main()
{
// declares an 1D Array of string.
string[] weekDays;
// allocating memory for days.
weekDays = new string[] {"Sun", "Mon", "Tue", "Wed",
"Thu", "Fri", "Sat"};
// Displaying Elements of array
foreach (string day in weekDays)
Console.Write(day + " ");
Console.ReadLine();
}
No comments