- NeuroLive.NET - http://blog.neurolive.net -
When to use a Dictionary (Hashtable)?
Posted By bigmoshi On July 27, 2009 @ 2:09 am In C# | No Comments
Here's a pretty good tutorial on hashtable / dictionaries. Found it while studying some performance issues between the use of try/catch vs contains key for a dictionary with about 200,000 key/value associations.
A Dictionary is closely related to a HashTable. There are many subtle differences between them, but one important difference is that a Dictionary is generally faster than a Hashtable for storing data.
The reason is that a Dictionary takes strongly-typed values as its input, so you do not suffer the performance impact of storing generic Objects and boxing/unboxing them into the proper types during use.
Article printed from NeuroLive.NET: http://blog.neurolive.net
URL to article: http://blog.neurolive.net/2009/07/when-to-use-a-dictionary-hashtable/
URLs in this post:
[1] http://www.kirupa.com/net/dictionary_hashtable.htm: http://www.kirupa.com/net/dictionary_hashtable.htm
Click here to print.
Copyright © 2009 Neuro Live. All rights reserved.