Archive

Posts Tagged ‘Yield’

Understanding the “yield” keyword in 120 Seconds

April 17th, 2011

I’m about to release my own take on coroutines, and as a complementary app, I created a very simple sample that lets developers (hopefully) experience the fundamental behavioral difference of returning a sequence of values through the yield keyword.

There’s a lot of great material that can be read about iterator blocks (Google is your friend), and I’m not planning to add another article on top of that. So, stop reading and:

  • Download the sample (VS2010).
  • Quickly glance at the few lines in the code-behind of the window.
  • Run the app.
  • Bow in front of the power of iterators 😉

image

 

Download Sample Application

Author: Categories: C# Tags: ,