Friday, August 22, 2014

Why I love yield return

Aside from it's memory efficient as compared to eagerly populating list: http://ideone.com/QxU7Sn

..it saves us a lot of boilerplate codes too, there was once in C#'s life that there's no yield return magic yet, we have to contend with iterator design pattern, and that entails a lot of boilerplates code: http://www.ienablemuch.com/2010/12/lazy-loading-fibonacci.html


Long and short of why yield return is so awesome:
http://www.ienablemuch.com/2012/08/use-components-that-uses-yield-return.html


Use yield return when returning IValidatableObect, or any list for that matter. There's no need to create a List<ValidationResult>
http://www.ienablemuch.com/2011/07/ivalidatableobject-client-side.html

No comments:

Post a Comment