ArrayList.Repeat Method returns an ArrayList whose elements are copies of the specified value.
Imports System Imports System.Collections Imports Microsoft.VisualBasic Public Class SamplesArrayList Public Shared Sub Main() Dim myAL As ArrayList = ArrayList.Repeat(Nothing, 5) Console.WriteLine("Count : {0}", myAL.Count) Console.WriteLine("Capacity : {0}", myAL.Capacity) Console.Write(" Values:") PrintValues(myAL) myAL = ArrayList.Repeat("abc", 7) Console.WriteLine("Count : {0}", myAL.Count) Console.WriteLine("Capacity : {0}", myAL.Capacity) Console.Write(" Values:") 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 End Class