3 ms·
It's always nice when you finally understand "magic".
by nocipher 16y ago
It's always nice when you finally understand "magic".
- MarkSweep 16y agoI 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 http://gist.github.com/524972 What the compiler generates for the above example: http://gist.github.com/524974 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.