Well then I read this article. But still I'm not quite sure I understand how this works.
Here's the original function in c#:
c# Code:
public static IEnumerable ForwardNodeIterator(Node firstNode, bool mustBeVisible)
{
ForwardNodeEnumerator iterator = new ForwardNodeEnumerator(firstNode, mustBeVisible);
while (iterator.MoveNext())
yield return iterator.Current;
}
I have a class that implements IEnumerator(Of node) (as in the original and it does not implement IEnumerable. Does the article you provided suggest that I need also a helper class that implements IEnumerable(Of Node) in order to achieve the result?
P.S.
I have a class that implements IEnumerator
If add this to the class:
vb Code:
Implements IEnumerator(Of Node)
' IEnumerator implementation here
Implements IEnumerable(Of Node)
Public Function GetEnumerator() As System.Collections.Generic.IEnumerator(Of Node) Implements System.Collections.Generic.IEnumerable(Of Node).GetEnumerator
Return Me
End Function
Public Function GetEnumerator1() As System.Collections.IEnumerator Implements System.Collections.IEnumerable.GetEnumerator
Return Me
End Function
would this work?