Monday, May 21, 2012

Finding the right way to store data

I had planned on using a Dictionary or SortedList for this but as the project evolved while planning it, I'm not sure what to do.



My site will load a bunch of results from a DB Query and I need to be able to store these results somewhere.



Here's how the results look like:



What type of Dictionary/List should be used for this?



So, here's what I am storing:



Result #1 (int) > Name > Value
> Title > Value
> Message > Value
> Date > Value
> Email > Value

Result #2 (int) > Name > Value
> Title > Value
> Message > Value
> Date > Value
> Email > Value

Result #3 (int) > Name > Value
> Title > Value
> Message > Value
> Date > Value
> Email > Value

Result #4 (int) > Name > Value
> Title > Value
> Message > Value
> Date > Value
> Email > Value


... and so on. My main concern is that most of the Dictionaries and Lists and Sorted/Linked lists cannot have dupliate keys or values. So I can't use them for this, because each Result will have all the same Key names, like Name, Title, Message, etc. Values may differ, though many of the values such as Name and Date and other ones will be dupes. So I'm kinda stuck with not knowing which kind of Dictionary/List to choose which allows duplicate keys/names and _not knowing how to get that 'one to many' relationship thing going on so i can store these results properly.



Can someone please help me with what would be the best way to go about this?





No comments:

Post a Comment