Udostępnij za pośrednictwem


Does VB.NET have a Yield Return, as with C#?

Someone asked me about this and I wasn't sure.  So I looked around and didn't see a definitive answer.  I asked the VB Team and got it. VB.NET does not have language support for iterators.   There's nothing in VB.NET like the yield return or yield break stuff in C#.

I did find an article that seems to indicate the opposite - it was apparently translated from C# to VB.NET.  Don't believe this article!

By the way, the first time I looked at the yield statement, I thought it was a curiosity,  But it is really handy and simplifies things greatly when building a custom enumerated collection. Check this article from Juval Lowy for an explanation.