yield return “elegant code”

I didn’t think the new iterator pattern in c# 2.0 would be as useful as the other new features. I though, how many problems are solved with enumerators? Well, here is a great example where creating an enumerator isn’t the problem being solved, it’s an elegant HTTP application pipeline that uses the state machine automatically created by the c# compiler for handling asynchronous work. The new yield return statement simplifies the code significantly.

Iterators and Efficient Use of the Thread Pool