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

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -