Home  |  Delphi .net Home  |  System.Collections NameSpace
 .NET Framework
 Namespace References

  ArrayList  Class 
  BitArray  Class 
  CaseInsensitiveComparer  Class 
  Comparer  Class 
  DictionaryEntry  Structure 
  HashTable  Class 
  ICollection  Interface 
  IComparer  Interface 
  IDictionary  Interface 
  IDictionaryEnumerator  Interface 
  IEnumerator  Interface 
  IList  Interface 
  Queue  Class 
  SortedList  Class 
  Stack  Class 

 Articles and Tutorials

 Overview of .NET
 Delphi and .NET
 Winform Applications
 ASP .Net Applications
 ASP Web Services
 Framework Collections
 Framework String Handling
 Framework Files and Folders

 Author links

 Buy Website Traffic at

 Buy Proxies at

  System.Collections.ArrayList Class
Calling writeTextBlock ArrayList is different in operation to the native Delphi primitive Array data type, and the System.Array class.
Unlike these other types, ArrayList supports element add and delete - the array size is readily modifiable. It is similar in operation to the native Classes unit TList class.
Like TList, ArrayList can hold a mix of data types - each element can hold any object type. You may need to cast to TObject to store primitive values such as numbers.
Internally, the list works with a certain Capacity of elements - when exceeded, the list size is doubled. The starting size is 16. You can reduce the capacity of an ArrayList object that has grown and now shrunk so as to release the now unneeded memory allocation.
You would use an ArrayList when you are dealing with a list that is volatile - maybe where the user can edit the contents.
You can create a new ArrayList using an existing System.Collections collection to furnish the data contents. After writeTextBlock
Constructor Create ;
Constructor Create ( InitialCapacity : Integer );
Constructor Create ( SourceCollection : ICollection );
Add  Add a new Element to the end of the ArrayList
AddRange  Add a range of elements to the end of the ArrayList
BinarySearch  Searches the sorted ArrayList for a specific element
Clear  Remove all elements from the ArrayList
Clone  Creates a shallow clone (copy) of the current ArrayList to another
Contains  Searches the sorted ArrayList for a specific element
CopyTo  Copies elements from the ArrayList to a single dimension array
GetEnumerator  Gets an enumerator to allow reading the elements of the current ArrayList
GetRange  Creates a new ArrayList from a subset of the current ArrayList elements
IndexOf  Tries to find the first occurence of an object in the current ArrayList
Insert  Insert a new element into the ArrayList at the specified index position
InsertRange  Add a range of elements into the ArrayList
LastIndexOf  Tries to find the alst occurence of an object in the current ArrayList
Remove  Remove a particular Object Element from the ArrayList
RemoveAt  Remove an element from the ArrayList at the specified index position
RemoveRange  Remove a range of elements from the ArrayList
Repeat  Create a new ArrayList with all elements set to the same value
Reverse  Reverse the sequence of elements in the ArrayList
SetRange  Overlays elements from a collection onto the current ArrayList
Sort  Sort the elements in the ArrayList into sequence
ToArray  Copies elements from the ArrayList to a new single dimension array
TrimToSize  Removes unused elements from the current ArrayList

Capacity  Integer  The number of elements for which space is currently reserved
Count  Integer  The actual number of elements in the array
IsFixedSize  Boolean  If the array is constrained to updates only, with no element addition or removal. Use the FixedSize method to create an ArrayList with a fixed size.
IsReadOnly  Boolean  The array cannot be updated in any way. Use the ReadOnly method to create a read only array.
IsSynchronised  Boolean  Used for safer thread operation - but even this set to true will not help protect enumeration scans of an ArrayList from other threads updating.
Item  Object  Indexed propetry - the indexed element can be read or updated
SyncRoot  Object  Advanced synchronation mechanism

 Microsoft MSDN links
Delphi Programming Neil Moffatt 2002 - 2016. All rights reserved.  |  Home Page