Hashtable.Add : HashTable « System.Collections « C# / C Sharp by API






Hashtable.Add

  

using System;
using System.Collections;

public class Starter {
    public static void Main() {
        Hashtable zHash = new Hashtable();
        zHash.Add("one", 1);
        zHash.Add("two", 2);
        zHash.Add("three", 3);
        zHash.Add("four", 4);
        IDictionaryEnumerator e = zHash.GetEnumerator();
        while (e.MoveNext()) {
            Console.WriteLine(
                "{0} {1}",
                e.Key, e.Value);
        }
    }
}

   
    
  








Related examples in the same category

1.HashTable.Keys
2.HashTable.Remove
3.Hashtable.ContainsKey
4.Hashtable.ContainsValue
5.Hashtable.Keys.CopyTo
6.Hashtable.Synchronized
7.Hashtable.Values
8.Hashtable.Values.CopyTo