Home  |  Delphi .net Home  |  System.Collections.HashTable  |  Clear Method
  
Clear  
Method  
Clear (remove) all key-value data pairs from the current HashTable
HashTable Class
System.Collections NameSpace
CF1.  Procedure Clear ;
CF : Methods with this mark are Compact Framework Compatible
Description
Removes all entries from the HashTable. The Count value is reset to zero. The capacity is unaffected.
Microsoft MSDN Links
System.Collections
System.Collections.HashTable
 Author links

 Buy Website Traffic at
 Buywebsitetrafficexperts.com

 Buy Proxies at
 Buyproxies.io
 
 
 
A simple example
program Project1;
{$APPTYPE CONSOLE}

uses
  System.Collections;

var
  MyTable    : System.Collections.HashTable;

begin
  // Create our hash table
  MyTable := HashTable.Create;

  // Add entries to it
  MyTable['Name']     := 'Neil Moffatt';
  MyTable['Age']      := TObject(47);
  MyTable['Birthday'] := DateTime.Create(1957, 2, 18);

  Console.WriteLine('Count = ' + MyTable.Count.ToString);
  Console.WriteLine;
  Console.WriteLine('Clearing the HashTable :');

  // Clear the HashTable
  MyTable.Clear;

  Console.WriteLine;
  Console.WriteLine('Count = ' + MyTable.Count.ToString);

  Console.Readline;
end.
   Count = 3
  
   Clearing the HashTable :
  
   Count = 0
 
 
Delphi Programming Neil Moffatt 2002 - 2017. All rights reserved.  |  Contact the author