Getting Values and Keys out of a Hashtable
Posted by: Rick Strahls WebLog,
on 05 Jan 2006 |
View original | Bookmarked: 0 time(s)
This sounds silly but I was doing looping through a Hashtable and scratching my head on how to get the KEYS from the table when using foreach. If you ever look at the various ICollection or IDictionary derived classes you’ll find that they all have Keys and Values collections but you can’t do anything useful with them to retrieve the key.
After my brain block of a few minutes lifted, I remembered that the raw Enumerators let you get at the data, but this isn’t the first time...