Enumerating the queue

PowerShell will display the content of a queue in the same way as it would the content of an array. It isn't possible to access elements of the queue by the index. The ToArray method may be used to convert the queue into an array if required:

$queue.ToArray() 

The preceding command returns an array of the same type as the queue. That is, if the queue is configured to hold strings, the array will be an array of strings.

The queue has a Peek method that allows retrieval of the next element in the queue without it being removed:

$queue.Peek() 

The Peek method will throw an error if the queue is empty (refer to the Removing elements from the queue section).

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.93.221