Wednesday, August 13, 2008

Yield and prepare to be enumerated!

Raymond Chen has written an illuminating blog post on what *actually* happens when you write an iterator in C#.

This explains clearly what’s going on – essential for getting your head around how to use them, and in particular the yield return and yield break statements.

Start Leeks linked to it as part of his series covering yield.

Syntactic sugar: http://blogs.msdn.com/oldnewthing/archive/2008/08/12/8849519.aspx

Update: Raymond has a posted two follow-up articles.

No comments: