Yield

Posted by Learner under C# on 2/3/2009 | Views : 2899 | Status : [Member] | Replies : 1
Hi,

Can somebody explain YIELD keyword in C# using a very simple example like what is the need of YIELD and what problem does it solve if we use YIELD in Iteration?




Responses

Posted by: Raja on: 2/3/2009 [Member] Starter

Up
0
Down
The yield keyword signals to the compiler that the method in which it appears is an iterator block. In the iterator block, the yield keyword is used together with the return keyword to provide a value to the enumerator object.

Please visit following article for the sample example.

http://msdn.microsoft.com/en-us/library/9k7k7cf0.aspx


Regards,
Raja, USA

Learner, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response