c# loop through array
//iterate the array
for (int i = 0; i < arr.Length; i++)
{
// loop ...
}
// or
foreach (var element in arr)
{
// loop ...
}
c# loop through array
//iterate the array
for (int i = 0; i < arr.Length; i++)
{
// loop ...
}
// or
foreach (var element in arr)
{
// loop ...
}
c# loop array
Debug.Assert((theData.Length % 3) == 0); // 'theData' will always be divisible by 3
for (int i = 0; i < theData.Length; i += 3)
{
//grab 3 items at a time and do db insert,
// continue until all items are gone..
string item1 = theData[i+0];
string item2 = theData[i+1];
string item3 = theData[i+2];
// use the items
}
c# loop through array
for (int i = 0; i < theData.Length - 2; i+=3)
{
// use theData[i], theData[i+1], theData[i+2]
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us