- When you Yield Break does the function that contains it return a value to the caller? If so, is it Null/Nothing, the default value for the type that the function is, or something else?
No, it does not return a value. It just ends the enumeration. You can say, that it sets IEnumerator.MoveNext()
return value to false
and that's it.
- When you Yield Break does the Iterator start over. In other words, the next time the Iterator is called, will it return the first item in the collection again?
It all depends on how your method is written, but when you call the method which uses yield
you're creating new instance of state machine, so it can return the same values again.
- What is the closest vb.net equivalent to Yield Break? Exit Function? Return Nothing? Something Else?
"You can use an Exit Function or Return statement to end the iteration."