how to use foreach loop over arrays in C#?

how to use foreach loop over arrays in C#?, someone asked me to explain?

Foreach Loop In C# is used to access or iterate each item in a collection. We use foreach, on a string array, to loop through the elements in the array.

 

class exampleforeach
{
static void Main()
{
string[] animals = { "monkey", "elephant", "lion" };
// ... Loop with the foreach keyword.
foreach (string value in animals )
{
Console.WriteLine(value);
}
}
}

Output:
monkey
elephant
lion

Post your comments / questions