11.10 - Hash Table - Dictionary

Objetive

Deliver here your dictionary using Hash Table

Solution

using System;
using System.Collections;

namespace TableHash
{
    class Program
    {
        static void Main(string[] args)
        {
            Hashtable myList = new Hashtable();

            myList.Add("white", "blanco");
            myList.Add("black", "negro");

            Console.WriteLine("The size is: " + myList.Count);
            
            Console.WriteLine("Contenido:");
            IDictionaryEnumerator miEnumerador = myList.GetEnumerator();
            
            while ( miEnumerador.MoveNext() )
                Console.WriteLine("{0} = {1}", miEnumerador.Key, miEnumerador.Value);
 
            if (myList.ContainsKey("orange"))
            {
                Console.WriteLine(myList["orange"]);
            }
        }
    }
}

Popular Posts