C
C Williams
I find myself needing to loop through various collections in .NET a lot.
I am wondering if there is a generally accepted method for doing so.
I see three main ways (I'll use rows in a DataTable, which I am doing a
lot of work with)
1) For each curRow in curTable.Rows
2) For i = 0 to curTable.Rows.Count -1
currow = curtable.rows(i)
3) use curTable.Rows.GetEnumerator
Option 1 yields the shortest code, but which runs the fastest? I
suspect they are very similar, but I also suspect that someone out there
actually *knows*!
Thanks for any insights you have!
-Casey
I am wondering if there is a generally accepted method for doing so.
I see three main ways (I'll use rows in a DataTable, which I am doing a
lot of work with)
1) For each curRow in curTable.Rows
2) For i = 0 to curTable.Rows.Count -1
currow = curtable.rows(i)
3) use curTable.Rows.GetEnumerator
Option 1 yields the shortest code, but which runs the fastest? I
suspect they are very similar, but I also suspect that someone out there
actually *knows*!
Thanks for any insights you have!
-Casey