Getting Values and Keys out of a Hashtable

Posted by: Rick Strahls WebLog, on 05 Jan 2006 | View original

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...

Advertisement

Similar Posts

  • Functional Programming via Anonymous Delegates and Script# more
  • Implementing Getting Things Done using Outlook 2007 more
  • SQL Brainteasers more
  • The Performance War: Using counts to help navigate flat performance reports more
  • 02 May 2005: Making Gnome Fun more
  • Regex 101 Answer I3 - Expand ranges in a string more
  • Independent Consulting and Back Office Services (Professional Umbrella Corporations) more
  • Charles Petzold is Right! (and some code, and some profiling, and some BSOD debugging) more
  • Two approaches to standardization more
  • Tired of Comcast... more

News Categories

.NET | ADO.NET | Agile | Ajax | Architecture | ASP.NET | BizTalk | C# | Certification | Community Server | dasBlog | DataGrid | DataSet | Debugger | DotNetNuke | Events | GridView | IIS | Indigo | JavaScript | Mobile | Mono | Patterns and Practices | Performance | Podcast | Refactor | Regex | Security | Sharepoint | Silverlight | Smart Client Applications | Software | SQL | VB.NET | Visual Studio | W3 | WCF | WinFx | WPF | WSE | XAML | XLinq | XML | XSD