Why can you not use yield in a lambda, when you can use await in a lambda?

Viewed 1774

According to Eric Lippert, anonymous iterators were not added to the language because it would be overly complicated to implement it.

That is okay with me, and it didn't bother me until they went ahead and implemented anonymous asynchronous methods. The compiler has to do the same thing for async methods as it has to for iterators (convert them into state machines), so I am very confused why anonymous iterators are not allowed as well, when anonymous async methods are.

Can someone shed some light on this?

3 Answers
Related