The Hashtable class represents a collection of key-and-value pairs that are organized based on the hash code of the key. The key is used to access the items in the collection. Hashtable.Remove(Object) Method is used to remove the element with the specified key from the Hashtable.
public virtual void Remove (object key);
key: It is the key of the element to remove of type System.Object.
- ArgumentNullException: If the key is null.
- NotSupportedException: If the Hashtable is read-only or has a fixed size.
Total number of entries in Hashtable : 4 Total number of entries in Hashtable : 3 Total number of entries in Hashtable : 2 Total number of entries in Hashtable : 5 Total number of entries in Hashtable : 4
- C# | Remove all elements from the Hashtable
- C# | Adding an element into the Hashtable
- C# | Check if a Hashtable is equal to another Hashtable
- C# | Remove the element with the specified key from a SortedList
- C# | Remove the specified element from a HashSet
- C# | Remove the element at the specified index of the ArrayList
- C# | How to remove the element from the specified index of the List
- C# | Remove element at specified index of Collection<T>
- C# | Get or Set the value associated with specified key in Hashtable
- C# Hashtable with Examples
- C# | Hashtable Class
- C# | Gets an ICollection containing the keys in the Hashtable
- C# | Check if Hashtable is read-only
- C# | Check if the Hashtable contains a specific Key
- Difference between Hashtable and Dictionary in C#
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.