| |
ArrayList: add, remove, IndexOf, Count, Contains, TrimToSize, GetEnumerator |
|
|
Imports System
Imports System.Collections
Public Class MainClass
Public Shared Sub Main()
Dim arrayList As arrayList = New arrayList(1)
arrayList.Add("a")
try
Console.WriteLine(arrayList(0))
Catch outOfRange As ArgumentOutOfRangeException
Console.WriteLine(outOfRange.ToString())
End Try
Console.WriteLine(arrayList.Count)
Console.WriteLine(arrayList.Contains("a"))
Console.WriteLine(arrayList.IndexOf("a"))
arrayList.Remove("a")
arrayList.TrimToSize()
Console.WriteLine(arrayList.Capacity)
arrayList.Add("a")
Dim enumerator As IEnumerator = arrayList.GetEnumerator()
While enumerator.MoveNext()
Console.WriteLine(enumerator.Current )
End While
End Sub
End Class
|
|
|
Related examples in the same category |
|