Multiple values for the same key HashMap in .NET (C#)

  • Thread starter Thread starter Sean
  • Start date Start date
S

Sean

Hi all,

I have problem finding the .NET equivalent of HashMap in
C++ STL.

I CANNOT use Hashtable because I want (there will be more
than one objects for the same key) objects with the same
key to be hashed into the same bucket and end up with all
the objects with the same key being in the same group.

Thank you very much in advance.



regards,
Sean
 
Sean said:
I have problem finding the .NET equivalent of HashMap in
C++ STL.

I CANNOT use Hashtable because I want (there will be more
than one objects for the same key) objects with the same
key to be hashed into the same bucket and end up with all
the objects with the same key being in the same group.

Thank you very much in advance.

If you want more than one object for the same key, you can make each
Hashtable entry an ArrayList which you add new entries to. It should be
fairly easy to encapsulate that behaviour if you want to.
 
Back
Top