Okay, I’ve learn’t something new today, so I’d thought I would share it with you, it’s the yeald keyword, the reason why I think I have not used or know about it before is that it is used for an IEnumerable collection, which has come more in to play with LINQ, here is a short example of how it can be used:


This generates the following output:




It just makes sense to do it this way, much cleaner and much more efficient.

For more details check of MSDN on yeald.

It’s worth noting that Yield is not support with VB.NET