George George

George George

  • NA
  • 778
  • 0

yield return

May 1 2008 10:24 AM

Hello everyone,


I can not find too much materials about yield return. In MSDN sample,

http://msdn.microsoft.com/en-us/library/9k7k7cf0(VS.80).aspx

what happens behind the scene of statement, "yield return result"?

I think what happens is a object instance which implements IEnumerable (collection pattern) interface is created (but what is the type of the instance? some C# internal type?), and each time "yield return result" is called, a new element is inserted into the internal array of the instance. Any more reference documents?


thanks in advance,
George


Answers (2)