Mega Code Archive

 
Categories / VB.Net / Data Structure
 

ArrayList Insert inserts an element into the ArrayList at the specified index

Imports System Imports System.Collections Imports Microsoft.VisualBasic Public Class SamplesArrayList         Public Shared Sub Main()         Dim myAL As New ArrayList()         myAL.Insert(0, "A")         myAL.Insert(1, "B")         myAL.Insert(2, "C")         myAL.Insert(3, "D")         myAL.Insert(4, "E")         myAL.Insert(5, "F")         Dim myQueue As New Queue()         myQueue.Enqueue("Q")         myQueue.Enqueue("W")         PrintValues(myAL)         PrintValues(myQueue)         myAL.InsertRange(1, myQueue)         PrintValues(myAL)     End Sub         Public Shared Sub PrintValues(myList As IEnumerable)         Dim obj As [Object]         For Each obj In  myList             Console.Write("   {0}", obj)         Next obj         Console.WriteLine()     End Sub 'PrintValues End Class