I am needing to convert the following For loop from VB to C#. Depending on externally derived circumstances, the step size may be positive or it may be negative. The value of iFirstVal may be less than iLastVal, or vice versa, and can change within a given run.
I have done a fair amount of searching and am not finding a way in C# that allows me to do the same thing. Code could be written that would call different methods depending on the first and last values. Since I end up using this sort of code a lot, I was hoping there would be a more direct way to do this in C#.
Thanks,
Paul Hudgens
C#:
For iCnt = iFirstVal To iLastVal Step iStep
...
Next iCnt
I have done a fair amount of searching and am not finding a way in C# that allows me to do the same thing. Code could be written that would call different methods depending on the first and last values. Since I end up using this sort of code a lot, I was hoping there would be a more direct way to do this in C#.
Thanks,
Paul Hudgens