You noted your question with both vb.net and C #, so in response to "If .net is physically repeated through the list, can I just save the counter on my own iteration in the list and save overhead?"
If your iteration with For i = first To last , then VB.NET will evaluate first and last when it enters the loop:
Dim first As Integer = 1 Dim last As Integer = 3 For i = first To last Console.Write(i.ToString() & " ") last = -99 Next
: 1 2 3
If you are performing an equivalent in C #, first and last are evaluated at each iteration:
int first = 1; int last = 1; for (int i = first; i <= last; i++) { Console.Write(i.ToString() + " "); last = -99; }
outputs: 1
If your .Count () / property function is expensively priced and / or you do not want it to be reevaluated at each iteration (for some other reason), then in C # you can assign it to a temporary variable.
source share