The Yield Keyword
yield is used to create an iterator without needing a temporary collection.
Example
csharp
public IEnumerable
It's very memory-efficient for large data sets because it produces items one by one.
C# Zero to Hero: Comprehensive Programming Masterclass
yield is used to create an iterator without needing a temporary collection.
csharp
public IEnumerable
It's very memory-efficient for large data sets because it produces items one by one.