StringEnumerator Class supports iteration over a StringCollection. : StringEnumerator « Data Structure « VB.Net






StringEnumerator Class supports iteration over a StringCollection.

 

Imports System
Imports System.Collections.Specialized

Public Class SamplesStringEnumerator

   Public Shared Sub Main()
      Dim myCol As New StringCollection()
      Dim myArr() As [String] = {"red", "orange", "yellow"}
      myCol.AddRange(myArr)

      Dim myEnumerator As StringEnumerator = myCol.GetEnumerator()
      While myEnumerator.MoveNext()
         Console.WriteLine("{0}", myEnumerator.Current)
      End While
      myEnumerator.Reset()
      If myEnumerator.MoveNext() Then
         Console.WriteLine("The first element is {0}.", myEnumerator.Current)
      End If
   End Sub 
End Class 

   
  








Related examples in the same category