Learning Reference Blog: http://www.cnblogs.com/yinrq/p/5584885.html
Use the Stopwatch class to test time-consuming code:
Using system;using system.collections;using system.collections.concurrent;using system.collections.generic;using        System.diagnostics;namespace webapp{class Program {static Hashtable _hashtable;        Static dictionary<string, string> _dictionary;        Static concurrentdictionary<string, string> _condictionary;            static void Main (string[] args) {Compare (5000000);            Console.ReadLine ();        Console.read ();            } public static void Compare (int datacount) {_hashtable = new Hashtable ();            _dictionary = new dictionary<string, string> ();            _condictionary = new concurrentdictionary<string, string> ();            Stopwatch Stopwatch = new Stopwatch ();            Hashtable Stopwatch.start (); for (int i = 0; i < Datacount; i++) {_hashtable.            ADD ("Key" + i.tostring (), "Value" + i.tostring ()); } STOPWAtch.            Stop ();            Console.WriteLine ("Hashtable" + Datacount + "bar time elapsed (milliseconds):" + stopwatch.elapsedmilliseconds);            Dictionary Stopwatch.reset ();            Stopwatch.start (); for (int i = 0; i < Datacount; i++) {_dictionary.            ADD ("Key" + i.tostring (), "Value" + i.tostring ());            } stopwatch.stop ();            Console.WriteLine ("Dictionary" + Datacount + "bar time elapsed (milliseconds):" + stopwatch.elapsedmilliseconds);            Concurrentdictionary Stopwatch.reset ();            Stopwatch.start (); for (int i = 0; i < Datacount; i++) {_condictionary.tryadd ("key" + i.tostring (), "Value" + I .            ToString ());            } stopwatch.stop ();            Console.WriteLine ("Concurrentdictionary" + Datacount + "bar time elapsed (milliseconds):" + stopwatch.elapsedmilliseconds);            Hashtable Stopwatch.reset ();            Stopwatch.start (); for (int i = 0; i < _hasHtable. Count;            i++) {var key = _hashtable[i];            } stopwatch.stop ();            Console.WriteLine ("Hashtable Traversal Time (ms):" + stopwatch.elapsedmilliseconds);            Dictionary Stopwatch.reset ();            Stopwatch.start (); for (int i = 0; i < _hashtable. Count;            i++) {var key = _dictionary["key" + i.tostring ()];            } stopwatch.stop ();            Console.WriteLine ("Dictionary Traversal Time (ms):" + stopwatch.elapsedmilliseconds);            Concurrentdictionary Stopwatch.reset ();            Stopwatch.start (); for (int i = 0; i < _hashtable. Count;            i++) {var key = _condictionary["key" + i.tostring ()];            } stopwatch.stop ();        Console.WriteLine ("Concurrentdictionary Traversal Time (ms):" + stopwatch.elapsedmilliseconds); }    }}
  
Final Summary:
Big Data Insertion Dictionary take the least time
Traverse Hashtable fastest is the 1/5,concurrentdictionary of the dictionary 1/10
Single threaded recommendations with dictionary, multithreading recommendations with Concurrentdictionary or Hashtable (Hashtable tab = hashtable.synchronized (New Hashtable ()); Get thread-safe objects)
C # Dictionary Collection Hashtable, Dictionary, concurrentdictionary three differences