Monday, February 24, 2014

Iterators in C#


Have you used yield keyword with c# any time ? I also never used Yield keyword prior to this article. The only thing that drove me to write this article is that Yield uses state machine while doing things.

I've some knowledge about state machines concept, which I've studied in my graduation course. But never saw something that uses state machines in practical.

Though yield offers a nice mechanism to preserve the state and offer a deferred execution, it is used less in the daily programming basis. But still it's good to know what this yield does.