Programming Tutorials

Queue data structure in

By: Issac in Tutorials on 2009-01-30  

In VB.NET, you can implement a queue data structure using the Queue class. Here's an example:

Dim queue As New Queue()

' Adding items to the queue

' Removing items from the queue
Dim item1 As String = queue.Dequeue()
Dim item2 As String = queue.Dequeue()

' Displaying the remaining items in the queue
For Each item As String In queue

In this example, we first create a new Queue object. We then add three items to the queue using the Enqueue method. Next, we remove two items from the queue using the Dequeue method, which removes and returns the item at the beginning of the queue. Finally, we loop through the remaining items in the queue and display them using a For Each loop.

Add Comment

* Required information


No comments yet. Be the first!

Most Viewed Articles (in )

Latest Articles (in