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){
        yield return myValue;
}//end method

Edited 1 Year Ago by overwraith

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 article has been dead for over six months. Start a new discussion instead.