Generator (computer programming): Difference between revisions

Content deleted Content added
changed to citation
Line 429:
===C#===
An example C# 2.0 generator (the <code>yield</code> is available since C# version 2.0):
Both of these examples utilize Generics, but this is not required. yield keyword also helps in implementing custom stateful iterations over a collection as discussed in [this discussion<ref>{{Cite web|url=https://stackoverflow.com/questions/39476/what-is-the-yield-keyword-used-for-in-c/15977474#15977474|title=What thisis SOthe discussion]yield keyword used for in C#?|website=stackoverflow.com|access-date=2018-01-01}}</ref>.
 
<syntaxhighlight lang="csharp">