C# Iterators Are AWESOME But Why I HATE Them
December 22, 2023
• 558 views
ienumerablemicrosoft mvpenumeratorforeach ienumerable c#foreach ienumerablec# enumerable foreachforeach c#ienumeratoryield c#how do enumerables workforeachenumerablec# foreachc# ienumerable foreachc# iterationienumerable vs ienumeratorienumerable vs ilistc# iteratoriterator pattern c#iterator design patternc# yield returnc# yielditerator patternyield keywordc# iteratorsienumerable tutorialdotnetdesign patternsC#csharp
In this video, we're going to learn how to create a lazy enumerable in C# called an iterator. An iterator is a collection of items that are evaluated only when they're accessed, instead of being computed immediately.
This is a useful technique if you want to avoid expensive computations, or if you need to store data in a memory-efficient format. I'll demonstrate how to create an iterator in C#, and then use it to list all the items in a collection.
Have you subscribed to my weekly newsletter y...
