IEnumerable and IEnumerator in the same class, bad idea?
- by David Rutten
Is this a bad idea?
Private Class GH_DataStructureEnumerator(Of Q As Types.IGH_Goo)
Implements IEnumerable(Of Q)
Implements IEnumerator(Of Q)
....
....
'Current, MoveNext, Reset etc.'
....
....
Public Function GetEnumerator_Generic() As IEnumerator(Of Q) _
Implements IEnumerable(Of Q).GetEnumerator
Return Me
End Function
End Class
This class is only visible as an IEnumerable(Of T) readonly property, and it saves me an additional class that wraps IEnumerator(Of T). But somehow it just seems wrong. Is there a better way?