Groups | Blog | Home
all groups > dotnet clr > november 2004 >

dotnet clr : How to find all keys map to a object in a Hashtable?


Jon Skeet [C# MVP]
11/28/2004 12:48:50 PM
[quoted text, click to view]

You can't, basically. You have to iterate through each DictionaryEntry,
and pick out the ones with the right value.

If you know that you're going to want to do this, however, you could
have another hashtable where the value in the first table is the key in
the second table, and the value in the second table is an ArrayList of
keys in the first table which map to that value.

--
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
Lei Jiang
11/28/2004 6:25:04 PM
Sometimes there are several keys map to the same object in the hashtable.
How to find them quickly given the object?

AddThis Social Bookmark Button