C# Hashtable Remove
Description
Hashtable Remove
removes the element with the specified
key from the Hashtable.
Syntax
Hashtable.Remove
has the following syntax.
public virtual void Remove(
Object key
)
Parameters
Hashtable.Remove
has the following parameters.
key
- The key of the element to remove.
Returns
Hashtable.Remove
method returns
Example
The following code uses Remove
method to
remove key/value pairs from Hashtable
.
using System;//from ww w . j a v a 2s .c om
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);
}
}
The code above generates the following result.