Hacker News new | past | comments | ask | show | jobs | submit login

I found looking at the code that the C# compiler generates for its yield keyword to also be helpful for understanding this keyword.

Source of an iterator example: http://gist.github.com/524972

What the compiler generates for the above example: http://gist.github.com/524974

The meat of it is in the MoveNext() function, where the original function is split up along the yield keywords into cases in a switch statement.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: