G
Guest
From the documentation in MSDN, it looks as though the following should
iterate through the collection twice. However, MoveNext in the second
iteration returns false:
Dim oList As New List(Of String)
oList.Add("Hello")
oList.Add("world")
Dim oEnum As List(Of String).Enumerator = oList.GetEnumerator()
While oEnum.MoveNext()
Dim sValue As String = oEnum.Current
End While
CType(oEnum, IEnumerator).Reset()
While oEnum.MoveNext()
Dim sValue As String = oEnum.Current
End While
Anyone know what I am doing wrong?
iterate through the collection twice. However, MoveNext in the second
iteration returns false:
Dim oList As New List(Of String)
oList.Add("Hello")
oList.Add("world")
Dim oEnum As List(Of String).Enumerator = oList.GetEnumerator()
While oEnum.MoveNext()
Dim sValue As String = oEnum.Current
End While
CType(oEnum, IEnumerator).Reset()
While oEnum.MoveNext()
Dim sValue As String = oEnum.Current
End While
Anyone know what I am doing wrong?