VB.net Program to Convert the Queue Collection Into an Object Array

VB.Net program to convert the Queue collection into an Object array

'VB.Net program to convert the Queue collection 
'into an Object array.

Imports System
Imports System.Collections

Module Module1
    Sub Main()
        Dim arr(4) As Object
        Dim queue As New Queue(5)

        queue.Enqueue("India")
        queue.Enqueue("USA")
        queue.Enqueue("UK")
        queue.Enqueue("CHINA")

        arr = queue.ToArray()

        Console.WriteLine("Object Array elements are:")
        For i = 0 To 3 Step 1
            Console.WriteLine(vbTab & "Item[" & (i + 1) & "]: " & arr(i))
        Next
    End Sub
End Module
Object Array elements are:
        Item[1]: India
        Item[2]: USA
        Item[3]: UK
        Item[4]: CHINA
Press any key to continue . . .
Share on:

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Comment