I’ve got a mysql table that has entries with a unique ID, then 3 properties.
I’m displaying the IDs in a ListBox, and the other information goes on other parts of my page. It gets re-used often enough that I don’t want to do another query every time I need to reference it. My question is this: What kind of data structure should I use to hold the row data?
Is a 2-dimensional array the best option? If so, is it poor style to use a Hashtable with the key being the ID and the value being a reference to an array containing all the values for that row?
I’m using .NET 4, and coding this in C#.
A model looks appropriate to represent a row:
and
IEnumerable<Foo>to represent your SQL table. You would then of course have a repository with methods allowing you to fetch a single model given it’sIdor other criteria and to fetch all models. Then bind this model to your GUI.