473,513 Members | 3,949 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Hashtable vs. Dictionary.

What is the difference between a hashtable and a dictionary? Why isn't
Hashtable derived from DictionaryBase?
Nov 15 '05 #1
4 43817
The HashTable is the base class that is weakly type; the DictionaryBase
abstract class is stronly typed and uses internally a HashTable.

For more information, look here:
http://www.microsoft.com/belux/fr/ms...lections1.mspx

--
Greetz,
Jan
__________________________________
Read my weblog: http://weblogs.asp.net/jan
"Peter Rilling" <pe***@nospam.rilling.net> schreef in bericht
news:uv**************@TK2MSFTNGP12.phx.gbl...
What is the difference between a hashtable and a dictionary? Why isn't
Hashtable derived from DictionaryBase?

Nov 15 '05 #2
So conceptually there is really not much of a difference, right?

"Jan Tielens" <ja*@no.spam.please.leadit.be> wrote in message
news:OB**************@tk2msftngp13.phx.gbl...
The HashTable is the base class that is weakly type; the DictionaryBase
abstract class is stronly typed and uses internally a HashTable.

For more information, look here:
http://www.microsoft.com/belux/fr/ms...ens/collection
s1.mspx
--
Greetz,
Jan
__________________________________
Read my weblog: http://weblogs.asp.net/jan
"Peter Rilling" <pe***@nospam.rilling.net> schreef in bericht
news:uv**************@TK2MSFTNGP12.phx.gbl...
What is the difference between a hashtable and a dictionary? Why isn't
Hashtable derived from DictionaryBase?


Nov 15 '05 #3

"Peter Rilling" <pe***@nospam.rilling.net> wrote in message
news:e2**************@TK2MSFTNGP10.phx.gbl...
So conceptually there is really not much of a difference, right?

Just easier to work with. DictionaryBase is provided to make writing
strongly typed dictionaries easier, if you want to work with all
dictionaries you should use IDictionary as the base type.
"Jan Tielens" <ja*@no.spam.please.leadit.be> wrote in message
news:OB**************@tk2msftngp13.phx.gbl...
The HashTable is the base class that is weakly type; the DictionaryBase
abstract class is stronly typed and uses internally a HashTable.

For more information, look here:

http://www.microsoft.com/belux/fr/ms...ens/collection s1.mspx

--
Greetz,
Jan
__________________________________
Read my weblog: http://weblogs.asp.net/jan
"Peter Rilling" <pe***@nospam.rilling.net> schreef in bericht
news:uv**************@TK2MSFTNGP12.phx.gbl...
What is the difference between a hashtable and a dictionary? Why isn't Hashtable derived from DictionaryBase?



Nov 15 '05 #4
You can work with a Hashtable out of the box, but to use the DictionaryBase
class you'll have to create a new class and inherit from the DictionaryBase
class.

--
Greetz

Jan Tielens
________________________________
Read my weblog: http://weblogs.asp.net/jan
"Peter Rilling" <pe***@nospam.rilling.net> wrote in message
news:e2**************@TK2MSFTNGP10.phx.gbl...
So conceptually there is really not much of a difference, right?

"Jan Tielens" <ja*@no.spam.please.leadit.be> wrote in message
news:OB**************@tk2msftngp13.phx.gbl...
The HashTable is the base class that is weakly type; the DictionaryBase
abstract class is stronly typed and uses internally a HashTable.

For more information, look here:

http://www.microsoft.com/belux/fr/ms...ens/collection s1.mspx

--
Greetz,
Jan
__________________________________
Read my weblog: http://weblogs.asp.net/jan
"Peter Rilling" <pe***@nospam.rilling.net> schreef in bericht
news:uv**************@TK2MSFTNGP12.phx.gbl...
What is the difference between a hashtable and a dictionary? Why isn't Hashtable derived from DictionaryBase?



Nov 15 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1205
by: Duncan Bayne | last post by:
Hi All, Be careful when indexing Hashtable elements by number. The following code will create two quite distinct entries in an Hashtable: myHashtable.Add((int)666, "Foo"); myHashtable.Add((long)666, "Foo"); Always ensure all indexing is done by the objects of the same type - it's probably safest to explicitly cast them.
4
10377
by: Matt C. | last post by:
I bet I know the answer already. I have a hashtable (hMaster) that holds several hashtables ("hTables") each of which holds other hashtables ("hColumns"). Presently, I am getting at the info I want thusly (this compiles, at least): Hashtable hTable = (Hashtable)hMaster; Hashtable hColumn = (Hashtable)hTable; return...
11
2737
by: Crirus | last post by:
Easyest and fastest way... :) -- Ceers, Crirus ------------------------------ If work were a good thing, the boss would take it all from you ------------------------------
12
1710
by: Marty | last post by:
Hi, Is there a way when using a hashtable in VB.NET to add value of a specific type and retrieve that same value without having to cast it to the original type? Thanks Marty
2
3538
by: Ray Cassick \(Home\) | last post by:
I have a hashtable in a class that contains key (strings) value (integers, strings, longs, etc...) data pairs. I want to move the data to another (different) class instance for processing. The key is that I want to make sure I don't rely on the first class to stay around so I want to make sure that when I move (copy) the data from one...
3
50522
by: Anders Borum | last post by:
Hello! I am using Hashtables to cache data in services and am looking at generics for typed access (I control the key/value types). However, I was surprised to see that the Dictionary throws a KeyNotFoundException if you try to reference missing keys, which is a change from the Hashtable. So what? Well, the idea of a cache is to ensure...
5
8548
by: Mark Rae | last post by:
Hi, In v1.x, I used to use the following code to create a case-insensitive Hashtable: Hashtable MyHashtable = new Hashtable(CaseInsensitiveHashCodeProvider.Default, CaseInsensitiveComparer.Default); In v2, this generates the following warnings:
8
2065
by: Martin Pöpping | last post by:
Hello, I´ve implemented a Hashtable with Int-Keys and Double Values. Now I want to get the i-th Int-Key of my hashtable. How do I do that? I tried it like that: ICollection intKeys = myHashtable.Keys;
10
8485
by: chrisben | last post by:
Hi, Here is the scenario. I have a list of IDs and there are multiple threads trying to add/remove/read from this list. I can do in C# 1. create Hashtable hList = Hashtable.Synchronized(new Hashtable()); 2. create ArrayList aList = ArrayList.Synchronized(new ArrayList()); 3. create a string sList = ""; For 1 and 2, since the list is...
9
3094
by: raylopez99 | last post by:
Hello all— I’m trying to get the below to work and cannot get the format right. It’s from this example: http://msdn.microsoft.com/en-us/library/8627sbea(VS.71).aspx What it is: I’m trying to store multicast delegates in a hash table, and then fire the delegates one of two ways (after registering/ creating the delegates, etc).
0
7178
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7397
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7563
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7543
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5703
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5102
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3252
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
1612
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
470
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.