How to VB.Net Queue
The Queue is another adtastructure from VB.NET Collections . Queue works like First In First Out method and the item added first in the Queue is first get out from Queue. We can Enqueue (add) items in Queue and we can Dequeue (remove from Queue ) or we can Peek (that is get the reference of first item added in Queue ) the item from Queue.
The commonly using functions are follows :
Enqueue : Add an Item in Queue
Dequeue : Remove the oldest item from Queue (we dont get the item later)
Peek : Get the reference of the oldest item (it is not removed permenantly)
The following VB.NET Source code shows some of commonly used functions :
When you execute the program it add seven items in the Queue. Then it Dequeue (remove) the oldest item from queue. Next it Peek() the oldest item from Queue (shows only , not remove ). Next it check the Item "Sun" contains in the Queue.