PreviousNext

C# internals: iterators

by bill-s, 2018-02-19T23:55:01.890Z

Despite the fact that iterators (using yield keyword) were introduced back in C# 2.0, many folks are still confused how they work. Honestly, I’m not surprised at all, because to me this mechanism was a mystery for a long time. Of course, we have to clearly distinguish two things here: How does yield return work? (on C# level) How does yield return actually work THIS way? (this is the topic of today’s article) Let’s start with the first question. Asking a statistical C# developer, what’s the advantage of using yield return statement we could probably hear the following answer:

Read More