The Queue Collection

The System.Collections.Queue collection works according to the FIFO (First-In, First-Out) paradigm, meaning that the first item you add to the collection is the first pulled out from the collection. Queue exposes two methods, Enqueue that adds a new item to the collection and Dequeue that removes an item from the collection. Both methods receive an argument of type Object. The following code provides an example:

image

You just need to invoke the Dequeue method to consume and automatically remove an item from the collection. You can also invoke the Peek method which just returns the first item from the collection without removing ...

Get Visual Basic® 2010 Unleashed 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.