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

Advertisement
Category: ASP.NET | Other Posts: View all posts by this blogger | Report as irrelevant | View bloggers stats | Views: 3657 | Hits: 760

Similar Posts

  • Adding QueryString Parameters to the SiteMapNode more
  • Outlook Send Mail Infinite Loop Message in Outbox more
  • Developing RESTful services with JSON and POX support in the ASP.NET MVC more
  • Script to Inventory Print Servers more
  • Named Formats Redux more
  • Don’t use Response.End() with OutputCache more
  • What arrays and pointers have in common - or - Why arrays start at zero more
  • What arrays and pointers have in common - or - Why arrays start at zero more
  • What arrays and pointers have in common - or - Why arrays start at zero more
  • What arrays and pointers have in common - or - Why arrays start at zero more

News Categories

.NET | Agile | Ajax | Architecture | ASP.NET | BizTalk | C# | Certification | Data | 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