c# loop through array

C#
//iterate the array
for (int i = 0; i < arr.Length; i++)
{
  // loop ...
}
// or
foreach (var element in arr)
{
  // loop ...
}int[] numberArray = { 4, 5, 6, 1, 2, 3, -2, -1, 0 };
foreach (int number in numberArray)
{
    System.Console.Write("{0} ", number);
} for (int i = 0; i < theData.Length - 2; i+=3) 
    { 

        // use theData[i], theData[i+1], theData[i+2]

    } 
Source

Also in C#: