Queue Class represents a first-in, first-out collection of objects.
Imports System
Imports System.Collections
Public Class SamplesQueue
Public Shared Sub Main()
Dim myQ As New Queue()
myQ.Enqueue("A")
myQ.Enqueue("B")
myQ.Enqueue("C")
Console.WriteLine(" Count: {0}", myQ.Count)
PrintValues(myQ)
End Sub 'Main
Public Shared Sub PrintValues(myCollection As IEnumerable)
Dim obj As [Object]
For Each obj In myCollection
Console.Write(" {0}", obj)
Next obj
Console.WriteLine()
End Sub 'PrintValues
End Class 'SamplesQueue
Related examples in the same category