using System.Collections;
public static void Main()
Hashtable tabla = new Hashtable();
Console.WriteLine("---------------------");
Console.WriteLine("1. Add element");
Console.WriteLine("2. Remove element");
Console.WriteLine("3. Clear");
Console.WriteLine("4. Find Key");
Console.WriteLine("5. Find Value");
Console.WriteLine("6. Exit");
Console.WriteLine("---------------------");
Console.Write("Choose an option: ");
valor = Console.ReadLine();
opcion = Convert.ToInt32(valor);
Console.Write("Write the name of the product: ");
valor = Console.ReadLine();
llave = Convert.ToString(valor);
Console.Write("Write the price of the product: ");
valor = Console.ReadLine();
precio = Convert.ToDouble(valor);
tabla.Add(llave, precio);
Console.Write("Write the name of the product to be deleted: ");
valor = Console.ReadLine();
llave = Convert.ToString(valor);
Console.Write("Write the name of the product to be found: ");
valor = Console.ReadLine();
llave = Convert.ToString(valor);
encontrado = tabla.Contains(llave);
Console.WriteLine("Element Found = {0}", encontrado);
Console.Write("Write the value to be found: ");
valor = Console.ReadLine();
precio = Convert.ToDouble(valor);
encontrado = tabla.ContainsValue(precio);
Console.WriteLine("Element Found = {0}", encontrado);
Console.WriteLine("The Hashtable has {0} couples of key-value", tabla.Count);
foreach (DictionaryEntry datos in tabla)
Console.Write("[{0}, {1}]\t", datos.Key, datos.Value);