Possible Duplicate:
(C#) Get index of current foreach iteration
Good morning,
Is there any way I can get the index of an Enumerator
's current element (in the case, a character in a string) without using an ancillary variable? I know this would perhaps be easier if I used a while
or for
cicle, but looping through a string using an enumerator is more elegant... The only drawback for the case is that I really need to get each character's current index.
Thank you very much.