Author | Message | Time |
---|---|---|
Imperceptus | I would like to use step in my code like so [code] For Each att As objValue In SearchSet Step 2 Next [/code] but vs2k8 only seems to want to let me do [code] For Each att As objValue In SearchSet Next [/code] Is what I want to not possible without possibly doing? [code] For Counter as Integer = lbound(searchset) to ubound(searchset) step 2 Next [/code] Thanks in advance | July 28, 2009, 6:49 PM |
Myndfyr | You can't do this with a For Each loop; For Each is an implicit call to IEnumerable.MoveNext(). What you could do is save state: [code] Dim n As Integer = 0 For Each att As objValue In SearchSet n = n + 1 If n Mod 2 = 0 Then Continue End If ' Other logic Next [/code] Not terribly good-looking or straightforward, but it could work. | July 29, 2009, 4:27 AM |
Imperceptus | alrighty, will look into that one. and your right its ugly lol. | July 30, 2009, 2:18 PM |