System.Collections.Hashtable
Added in .NET 1.1
This should have been called System.Collections.Dictionary
There is no non-generic class called Dictionary.
The non-generic equivalent of Dictionary<TKey, TValue> is called Hashtable.
When anyone refers to a Dictionary they are referring to the generic class.
This is a collection of key/value pairs that are organised based on the hash code of the key.
System.Collections.Hashtable
This collection stores information based on their unique key
Their key has an Int21 data type and is called a hash code.
System.Collections.Hashtable myHashtable;
myHashtable = new System.Collections.Hashtable();
myHashtable.Add("GBP", 15);
myHashtable.Add("USD", 25);
myHashtable.Add("EUR", 35);
Value = HashTable[Key];
int myInteger = myHashtable["EUR"];
System.Collections.Hashtable myHashtable;
myHashtable = new System.Collections.Hashtable();
myHashtable.Add("Mon", new System.DateTime(2020,10,3));
myHashtable.Add("Tue", new System.DateTime(2021,10,3));
myHashtable.Add("Wed", new System.DateTime(2022,10,3));
if (myHashtable.ContainsKey("Tue")
{
System.DateTime myDateTime;
myDateTime = (System.DateTime)myHashtable["Tue"];
}
myHashtable.Clear();
myHashtable.Remove
The generic version of this collection is System.Collections.Generic.Dictionary
System.Collections.IDictionary
Added in .NET 1.1
This interface extended the ICollection interface.
This is the maximum functionality and gives you foreach, count, index/key, add, remove, contains, clear
The IDictionary interface is the base interface for standard collections of key/value pairs.
Each element is a key/value pair stored in a DictionaryEntry object.
© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited TopPrevNext