I want to have a enumerator/generator that will always provide me with the next value whenever I call say GetNext? Is this possible?
Examples:
myStringEnumerator.GetNext()
-> returns "Identifier01.xml"
myStringEnumerator.GetNext()
-> returns "Identifier02.xml"
myStringEnumerator.GetNext()
-> returns "Identifier03.xml"
myStringEnumerator.GetNext()
-> returns "Identifier04.xml"
myStringEnumerator.GetNext()
-> returns "Identifier05.xml"
...
evenNumberGenerator.GetNext()
-> returns 0
evenNumberGenerator.GetNext()
-> returns 2
evenNumberGenerator.GetNext()
-> returns 4
evenNumberGenerator.GetNext()
-> returns 6
evenNumberGenerator.GetNext()
-> returns 8
evenNumberGenerator.GetNext()
-> returns 10
...
I will not iterator on it in 1 place, but rather in many places and in very different times.
How do I do this in the most elegant way? If it's also fast, that's good too.