Home  |  Delphi .net Home  |  System.Collections.ArrayList  |  Add Method
  
Add  
Method  
Add a new Element to the end of the ArrayList
ArrayList Class
System.Collections NameSpace
CF1.  Procedure Add ( Value : Object ) ;
CF : Methods with this mark are Compact Framework Compatible
Description
The Value object is added as a new element to the end of the current ArrayList. The element Count is incremented by 1. The Capacity is doubled if exceeded.
Microsoft MSDN Links
System.Collections
System.Collections.ArrayList
 Author links

 Buy Website Traffic at
 Buywebsitetrafficexperts.com

 Buy Proxies at
 Buyproxies.io
 
 
 
Add various data types to an ArrayList
program Project1;
{$APPTYPE CONSOLE}

uses
  System.Collections;

var
  List : System.Collections.ArrayList;
  i    : Integer;

begin
  // Create our array list object
  List := ArrayList.Create;

  // Fill it with various things!
  List.Add('Age :');
  List.Add(TObject(47));
  List.Add('Born :');
  List.Add(DateTime.Create(1957, 2, 18));

  // Display the contents : note the 0 indexing
  for i := 0 to List.Count-1 do
    Console.WriteLine(List.Item[i]);

  Console.Readline;
end.
   Age :
   47
   Born :
   18/02/1957 00:00:00
 
 
Delphi Programming Neil Moffatt 2002 - 2017. All rights reserved.  |  Contact the author