Hashtables, or: How to look deeper than you need.

It is necessary at this point to find another way to represent data in memory that’s not based on a Dataset or an XmlDocument.

A list? Maybe a Collection? Or, specifically, an Hashtable?

This came as an epiphany yesterday morning. I was so caught up in trying to apply existing .NET CF structures that the obvious solution was simply not considered. May this be a lesson to all the youngsters around (and me) 🙂

So, I’ve built a Session class that holds the info from the XML file and some additional fields that will be “disconnected” from the main data, and created a Hashtable of Sessions to pack it all nicely. The key for the Hashtable is the Session ID, a unique identifier that serves its PK purpose quite nicely.

Using an in-memory data representation that’s abstracted from the persistent storage will also allow me to deal with performance issues later, as I will have to change only the loading function and leave the rest completely untouched.

I was pretty happy. And by 12.30AM last night I quickly reached feature parity with the previous version, with a much snappier interface (the load times remained the same).

Ah, the interface… And the feature list… something to be left to the next post.

Leave a Reply

Your email address will not be published. Required fields are marked *