vb.net - For Each Loop Iteration Count -
can keep track of our iteration in our loop when use for each? use each loops looping through objects cannot seem find way keep index of i'm @ in loop. unless of course create own ...
if want have index, use for
-loop instead of for each
. that's why exists.
for int32 = 0 objects.count - 1 dim obj = objects(i) next
of course nothing prevents creating own counter:
dim counter int32 = 0 each obj in objects counter += 1 next
or can use linq:
dim query = objects.select(function(obj, index) "index is:" & index)
Comments
Post a Comment