I have hashtable with key and values and in my code I am iterating hashtable through values like below :
foreach (Object clientObject in ClientList.Values)
{
// code to perform operation based on value
......
}
Where ClientList is hashtable. Now I want to get key of perticualar value from hashtable in my code. is there any way to achieve that ?
Thanks
You have to iterate through the table in this way:
Hashtable clientList = new Hashtable();
foreach (DictionaryEntry dictionaryEntry in clientList)
{
// work with value.
Debug.Print(dictionaryEntry.Value.ToString());
// work with key.
Debug.Print(dictionaryEntry.Key.ToString());
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With