Name

Stack.ToArray Method

Class

System.Collections.Stack

Syntax

stackvariable.ToArray(  )

Return Value

An Array of type Object

Description

Creates an array of type Object, copies the elements of the stack in order, and then returns the array

Programming Tips and Gotchas

Unlike the CopyTo method, the ToArray method does not require that we define an array in advance. However, we cannot specify the starting array index for the copy procedure.

Get VB .NET Language in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.