Remove from Hashtable

In this chapter you will learn:

  1. How to remove key and value pair from Hashtable

Revove from Hashtable

The following code uses Remove method to remove key/value pairs from Hashtable.

using System;/*from  jav  a  2 s  .c o m*/
using System.Collections;

class MainClass
{
  static void Main(string[] args)
  {
    Hashtable a = new Hashtable(10);
          
    a.Add(100, "A");
    a.Add(200, "C");
    

    a.Remove(100);
    a.Remove(200);

  }
}

Next chapter...

What you will learn in the next chapter:

  1. How to convert C# Hashtable to an array
Home » C# Tutorial » Collections
HashSet
Set operation: Except
Set operator intersect
Remove with condition
HashSet contains
HashSet creation
HashSet removing element
Sub set operations
Hashtable
Hashtable ContainsValue
Add elements to a Hashtable
Hashtable containsKey
Remove from Hashtable
Hashtable to array
Queue
Generic Queue
Stack