Re: Can use use value to find key (HashTable)

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



ad,

You will have to maintain another hashtable which places the value in
for the key, and the key for the value in order to do a reverse lookup like
this.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx

"ad" <ad@xxxxxxxxxxxxxxx> wrote in message
news:Ouxq%23xOpFHA.3936@xxxxxxxxxxxxxxxxxxxxxxx
>I have a hash table like:
> Hashtable myHT = new Hashtable();
> myHT.Add("First", "Hello");
> myHT.Add("Second", "World");
> myHT.Add("Third", "!");
>
> We can use key to find value like:
> myHT["First"] -> "Hello"
>
> But how can use use value to find key?
>


.



Relevant Pages

  • Re: Time Calculations
    ... I do not appear to have any trouble with ... > Ideally I do not want to ann in date and times. ... Prev by Date: ...
    (microsoft.public.excel.worksheet.functions)
  • Re: Religion in SF
    ... perhaps we can hash out our own definition or agree to disagree. ... The All-New, All-Different Howling Curmudgeons! ... Prev by Date: ...
    (rec.arts.sf.written)
  • Re: Police make dozens of arrests @ Rolling Stones concert.
    ... Hash is a ... byproduct of every harvest, not hard to find at all. ... Prev by Date: ...
    (rec.music.gdead)
  • Re: %USERACL Is Empty?!
    ... file and put it into that hash. ... > Expected output of the following script - test.pl: ... Xho ... Prev by Date: ...
    (comp.lang.perl.misc)
  • Re: How do I find the key of a specific hash element?
    ... How do I find the key of a specific hash element? ... At some point as hash size increases it will be faster to use a reverse lookup ... hash than doing a linear search through a hash converted to a list (I haven't ...
    (perl.beginners)