What is the use of c# “Yield” keyword ?

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.
原文地址:https://www.cnblogs.com/chucklu/p/11541898.html