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