YIELD Keyword

What is the purpose of YIELD Keyword in C#?

Questions by samieswaran   answers by samieswaran

Showing Answers 1 - 0 of 0 Answers

KamWah

  • Jul 7th, 2010
 

The yield keyword is used to specify the value (or values) to be returned to the caller's foreach construct. When the yield return statement is reaches, the current location is tored, and execution is restared from this location the next time the iterator is called.

  Was this answer useful?  Yes

phanish

  • Jul 17th, 2010
 

Used in an iterator block to provide a value to the enumerator object or to signal the end of iteration. It takes one of the following forms:

yield return <expression>;
yield break;

  Was this answer useful?  Yes

diejmon

  • Aug 18th, 2010
 

The yield keyword is used in an iterator block to provide a value to the enumerator object or to signal the end of the iteration. When used the expression is evaluated and returned as a value to the enumerator object. Note the expression has to be implicitebly convertible to yield type of the iterator.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions