Simple Lookup Table

Results 1 to 2 of 2

Thread: Simple Lookup Table

  1. #1
    Join Date
    Dec 1969

    Default Simple Lookup Table

    Hi! I&#039;m new to C# from Perl. My question is... how do I simulate the Perl "Hash of Hashes"? I have a SQLServer table with three columns, (category, subtype, descr). To avoid multiple joins in my DB queries I want to create an in-memory data structure to access this data. In Perl you create a hash with keys that are the categories (ie.: status code, unit of measure, etc.) and values that contain a hash whose keys are the item to be translated (ft) and values that are the description (Feet).<BR><BR>In Perl, it would be accessed like this: $value = $Lookup{UOM}{ft}; I imagine that in C#/.NET fw it could be: string value = Lookup.Type("UOM").Value("ft"); OR string value = Lookup("UOM", "ft");<BR><BR>Can anyone point me in the right direction about how to approach this in C#/.NET??? Thanks! Jason

  2. #2
    Join Date
    Dec 1969

    Default Try the DataSet object...

    You could do something like that with the HashTable objects, but it would be much simpler AND nicer looking code, to use the dataset object. You can define multiple tables, that have all the attributes of an actual data table. You can apply relationship objects between these tables, too. You can also serialize your dataset to XML extremely easily, if that is a concern.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts