C# Dictionary vs. List Lookup Time
Summary:
"Using Dictionary when the number of lookups greatly exceeds the number of insertions. It is fine to use List when you will have less than 4 items always. For lookups, Dictionary is usually a much better choice."
II. Dictionary vs. Hashtable
Why Dictionary is preferred over hashtable in C#?
"Because Dictionary is a generic class ( Dictionary
//dictionary
var customers = new Dictionary
...
Customer customer = customers["Ali G"];
//hashtable
var customers = new Hashtable();
...
Customer customer = customers["Ali G"] as Customer; //requies boxing
III. SortedList vs. SortedDictionary vs. Dictionary vs. Hashtable
IDictionary Options - Performance Test - SortedList vs. SortedDictionary vs. Dictionary vs. Hashtable
"Generic Dictionary is the absolute winner for insert and search operations if used with generic dictionary interface or directly." :)
No comments:
Post a Comment