Mega Code Archive

 
Categories / VB.Net / Data Structure
 

ArrayList FixedSize returns an ArrayList wrapper with a fixed size

Imports System Imports System.Collections Imports Microsoft.VisualBasic Public Class SamplesArrayList         Public Shared Sub Main()         Dim myAL As New ArrayList()         myAL.Add("A")         myAL.Add("B")         myAL.Add("C")         myAL.Add("D")         myAL.Add("E")         myAL.Add("F")         myAL.Add("G")         myAL.Add("H")         myAL.Add("I")         Dim myFixedSizeAL As ArrayList = ArrayList.FixedSize(myAL)         Dim msg As String         If myAL.IsFixedSize Then             msg = "has a fixed size"         Else             msg = "does not have a fixed size"         End If         If myFixedSizeAL.IsFixedSize Then             msg = "has a fixed size"         Else             msg = "does not have a fixed size"         End If     End Sub 'Main     Public Shared Sub PrintValues(myList As IEnumerable, mySeparator As Char)         Dim obj As [Object]         For Each obj In  myList             Console.Write("{0}{1}", mySeparator, obj)         Next obj         Console.WriteLine()     End Sub 'PrintValues End Class