Metodo TrimToSize

Imposta la capacità sul numero effettivo di elementi nell'oggetto ArrayList.

Sintassi

Object.TrimToSize()

Argomenti - Object: obbligatorio. Sempre il nome dell'oggetto ArrayList.

Note

Nell'esempio seguente viene illustrato l'uso del metodo TrimToSize.

Esempio 1

'Create ArrayList Object
Dim Obj
Set Obj = CreateObject("System.Collections.ArrayList")

'Add Elements to the end of ArrayList Object
Dim Index
Index = Obj.Add(10)
Index = Obj.Add(40)
Index = Obj.Add(20)

'Sets the capacity to the actual number of elements in the ArrayList object
Obj.TrimToSize ()
'Output: Internally ArrayList Capacity changed to the actual number of elements in the ArrayList object