ClassSystem.Collections.Queue (standard version) System.Collections.Generic.Queue (generic version) SyntaxqueueVariable.CopyTo(array, index)
DescriptionThe CopyTo method copies the queue elements into an existing array, starting at a specified array index. Usage at a Glance
ExampleThe sample code copies queue items to an array. Dim nameQueue As New Queue Dim nameArray( ) As Object ' ----- Build the queue. nameQueue.Enqueue("Chopin") nameQueue.Enqueue("Mozart") nameQueue.Enqueue("Beethoven") ' ----- Size the array and copy elements. ReDim nameArray(nameQueue.Count - 1) nameQueue.CopyTo(nameArray, 0) Version DifferencesVisual Basic 2005 adds support for generics to queues, as discussed in Chapter 10. See AlsoQueue Class, Queue.ToArray Method |