What is the use of c# “Yield” keyword ?
“Yield keyword helps us to do custom stateful iteration over .NET collections.”
There are two scenarios where “yield” keyword is useful:-
- Customized iteration through a collection without creating a temporary collection.
- Stateful iteration.