C# Hashtable Keys
Description
Hashtable Keys
gets an ICollection containing the keys
in the Hashtable.
Syntax
Hashtable.Keys
has the following syntax.
public virtual ICollection Keys { get; }
Example
using System;// www . j a v a 2 s. c o m
using System.Collections;
class MainClass
{
public static void Main()
{
Hashtable hash = new Hashtable();
hash["A"] = "1";
foreach (string firstName in hash.Keys)
{
Console.WriteLine("{0} {1}", firstName, hash[firstName]);
}
}
}
The code above generates the following result.