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.

 

posted @ 2019-09-18 14:34  ChuckLu  阅读(156)  评论(0)    收藏  举报