Hashtable

  • Thread starter Thread starter Dave
  • Start date Start date
You would have to manually search the table for that value.
You could enumerate the table to look for the value, for instance:

Hashtable ht...;
object value...;
IDictionaryEnumerator de = ht.GetEnumerator();
while (de.MoveNext())
{
if (value == de.Value)
Console.WriteLine(de.Key);
}
 
Dave said:
I know how to get Hashtable value by key, but How can I get Hashtable key by
it's value?

You can do it by brute force as Dennis said, but if you're going to
have to do this regularly, you should have two Hashtables - one to map
one way, and the other to map the other way.
 
Back
Top