0

Am having some difficulty, I had some code that had a static helper method in C#, and now I am looking to port it to vb, but unfortunately vb doesn't seem to have a yield return operator. How do most vb developers do this, and why is there no yield return, it kind of strikes me as a bit odd since C# is going all LINQ, and the only way to tweak Linq is to use custom IEnumerables etc. Code goes something like this in C#.

public static IEnumerable<String> MyMethod(Arg arg){
    while(...){
        yield return myValue;
    }
}//end method

Edited by overwraith

2
Contributors
3
Replies
26
Views
2 Years
Discussion Span
Last Post by ddanbe
1

?
VB has evolved to C# with somewhat different syntax.
It is also called VB.NET instead of just VB, VB4-5-6 or VBA.
So yield exists. See here.

Votes + Comments
Thanks ddanbe!
0

Ok, so the keyword I was missing was that it actually needs to have the "Iterator" Keyword. I had actually looked at that page, and I completely missed that nuance the first time. Thanks ddanbe!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.