loop for all elements of Array in C# code example
Example 1: c# loop through array
//iterate the array
for (int i = 0; i < arr.Length; i++)
{
// loop ...
}
// or
foreach (var element in arr)
{
// loop ...
}
Example 2: c# loop through array
for (int i = 0; i < theData.Length - 2; i+=3)
{
// use theData[i], theData[i+1], theData[i+2]
}