foreach start with index code example
Example 1: forEach index
const array1 = ['a', 'b', 'c'];
array1.forEach((element, index) => console.log(element, index));
Example 2: foreach index start from at 1 in c#
int i = -1;
foreach (Widget w in widgets)
{
i++;
// do something
}