I can enumerate through the entries in a HashTable with
foreach (DictionaryEntry de in ht)
but I want to know what the key is for entry x. Something like:
DictionaryEntry de = ht; // this does NOT return DictionaryEntry - it return the object with key 0
HashTable doesn't work that way.
You'd have to create a second hash table or dictionary that maps the other direction. Otherwise you have to use a
foreach, like you did in your question.