Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

get the index of the current iteration of a foreach loop?

foreach (var item in Model.Select((value, i) => new { i, value }))
{
    var value = item.value;
    var index = item.i;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #index #current #iteration #foreach
ADD COMMENT
Topic
Name
8+6 =