Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This example uses the foreach statement to access and display items of an array.
Example
int[] numbers = {1, 2, 3, 4, 5, 6, 7, 8, 9};
foreach (int element in numbers)
{
System.Console.WriteLine(element);
}
Compiling the Code
Copy the code and paste it into the Main method of a console application.