Home / Software / Tips and Tricks / What is the keyword yield in c sharp do?

What is the keyword yield in c sharp do?

Updated:  10/18/2013 05:10 AM
Author:  Shiju Mathews

Status:    Resolved.


The yield keyword signals to the compiler that the method in which it appears is an iterator block. The compiler generates a class to implement the behavior that is expressed in the iterator block. In the iterator block, the yield keyword is used together with the return keyword to provide a value to the enumerator object.