Yield Keyword
This keyword can be used when returning a value from a function.
A normal "return" does not preserve the state of the function while returning.
yield return
Returns an expression at each iteration
Using "yield return" the function is able to save its state while returning the value.
When the function is called a second time, it will continue the processing from where it has returned in the previous call.
yield break
Terminates the iteration
© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext