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

 System
 System.Collections
 
  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 
 System.Globalization
 System.IO

 Articles and Tutorials

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


 
 
  System.Collections.SortedList Class
 
 Description
The SortedList class should be used for holding a list of items that are referenced by key value, where the list must be in key sequence. You might want to use HashTable if you are not concerned about the sequencing.
 
This is principally an implementation of the IDictionary interface, where each entry in the list is a DictionaryEntry structure : a Key and Value data pair.
 
Entries in the list are automatically sorted into sequence, and can be retrieved by Key value or by (0-based) Index position. This index position is always into the sorted sequence of elements - a newly added element is put into the appropriate sort position in the list.
 Syntax
Constructor Create ( );
Constructor Create ( InitialCapacity : Integer ; );
Constructor Create ( Comparer : IComparer ; );
Constructor Create ( Comparer : IComparer; InitialCapacity : Integer );
Constructor Create ( Dictionary : IDictionary ; );
Constructor Create ( Dictionary : IDictionary; Comparer : IComparer );
 Methods
Add  Add an entry to the current SortedList
Clear  Clear (remove) all key-value data pairs from the current SortedList
Clone  Make a new SortedList that is a clone of the current SortedList
Contains  Returns true if the current SortedList contains the given Key
ContainsKey  Returns true if the current SortedList contains the given Key
ContainsValue  Returns true if the current SortedList contains the given Value
CopyTo  Copies elements from the SortedList to a single dimension array
GetByIndex  Gets the key-value pair at the specified index of the current SortedList
GetEnumerator  Gets an enumerator to allow reading the elements of the current SortedList
GetKey  Gets the key at the specified index of the current SortedList
GetKeyList  Gets a read-only, dynamically updated list of current SortedList keys
GetValueList  Gets a read-only, dynamically updated list of current SortedList values
IndexOfKey  Gets the index of the specified key in the current SortedList
IndexOfValue  Gets the index of the specified value in the current SortedList
Remove  Remove a key-value entry from the current SortedList
RemoveAt  Remove a key-value entry from the current SortedList at the specified Index
SetByIndex  Sets the value at the specified index of the current SortedList
TrimToSize  Removes unused elements from the current SortedList

 Properties
Capacity  Integer  Gets or sets the capacity of the SortedList.
Count  Integer  Gets the number of elements contained in the SortedList.
IsFixedSize  Boolean  Gets a value indicating whether the SortedList has a fixed size.
IsReadOnly  Boolean  Gets a value indicating whether the SortedList is read-only.
IsSynchronized  Boolean  Gets a value indicating whether access to the SortedList is synchronized (thread-safe).
Item  Object  Gets and sets the value associated with a specific key in the SortedList. This is the primary property and can be specied using [] brackets.
Keys  ICollection  Gets the keys in the SortedList.
SyncRoot  Object  Gets an object that can be used to synchronize access to the SortedList.
Values  ICollection  Gets the values in the SortedList.

 Delphi Basics links
 
System.Collections.IComparer
System.Collections.IDictionary
System.Collections.DictionaryEntry

 Microsoft MSDN links
 
System.Collections
System.Collections.sortedlist
 
Delphi Programming © Neil Moffatt . All rights reserved.  |  Home Page