Name

Queue.ToArray Method

Class

System.Collections.Queue

Syntax

                  queuevariable.ToArray(  )

Return Value

An Array of type Object

Description

This method creates an array of type Object, copies the elements of the queue — in order — to that array, and then returns the array.

Programming Tips and Gotchas

Unlike the CopyTo method, we do not need to define an array in advance. However, we cannot specify the starting array index for the copy procedure using ToArray.

Get VB.NET Language in a Nutshell, Second Edition 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.