MSDN Magazine April 2017: good article by Michaelis on Enumerators/Iterators
-
"Essential .NET - Understanding C# foreach Internals and Custom Iterators with yield" [^]
Quote:
For example, are you aware that foreach works differently for arrays than on IEnumberable collections? How familiar are you with the relationship between IEnumerable and IEnumerator? And, if you do understand the enumerable interfaces, are you comfortable implementing them using yield?
«When I consider my brief span of life, swallowed up in an eternity before and after, the little space I fill, and even can see, engulfed in the infinite immensity of spaces of which I am ignorant, and which know me not, I am frightened, and am astonished at being here rather than there; for there is no reason why here rather than there, now rather than then.» Blaise Pascal
-
"Essential .NET - Understanding C# foreach Internals and Custom Iterators with yield" [^]
Quote:
For example, are you aware that foreach works differently for arrays than on IEnumberable collections? How familiar are you with the relationship between IEnumerable and IEnumerator? And, if you do understand the enumerable interfaces, are you comfortable implementing them using yield?
«When I consider my brief span of life, swallowed up in an eternity before and after, the little space I fill, and even can see, engulfed in the infinite immensity of spaces of which I am ignorant, and which know me not, I am frightened, and am astonished at being here rather than there; for there is no reason why here rather than there, now rather than then.» Blaise Pascal