tag:blogger.com,1999:blog-125341290284114978.post7882761932355188576..comments2023-04-23T00:05:10.829-07:00Comments on Guy Ellis' Tech Blog: Yield return in C#Guy Ellishttp://www.blogger.com/profile/02574435376236977220noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-125341290284114978.post-108869867958329522009-11-27T19:23:05.000-08:002009-11-27T19:23:05.000-08:00Thanks for the comment David. Until you wrote that...Thanks for the comment David. Until you wrote that I didn't realize that that was what was happening behind the scenes for yield return. I though that it was building the list and returning it and hence my comment about syntactic sugar.<br />After some further investigation I see that you are correct and it is suitable for allowing the processing of lists of infinite size.<br />Thanks for your comment - appreciated!guy ellisnoreply@blogger.comtag:blogger.com,1999:blog-125341290284114978.post-32391549582078336172009-11-27T11:11:46.000-08:002009-11-27T11:11:46.000-08:00I think it is more than syntactic sugar, providing...I think it is more than syntactic sugar, providing some kind of on-demand list processing magic.<br />I used it recently to iterate through a very large list of member details. Rather than load them all into a huge list taking up loads of memory, then process each item in the list, yield meant I could call one row at a time from the db and process it with a very low memory footprint.David Wainwrightnoreply@blogger.com