Hope this isn't too much of a newb question. I'll ask it in the context of what I'm trying to do so that maybe it's more clear. I'm working on a site that has a list of featured products that I'd like to store in a table form in cache, since this info doesn't change much and will be used on many pages. Here is what I'm wondering:
Is it better to store this information in a DataTable or a DataSet? This table does not need to have any sort of relationship with other tables that will be in cache. Do I avoid any overhead related to this by not using a DataSet? Whether this is true or not - does it make it harder for the cache to manage itself if you have a DataSet containing multiple tables in cache as opposed to individual DataTables - for memory management, won't cache have to remove the entire DataSet if resources run low, as opposed dropping individual DataTables?
And I suppose the last question I should ask is: Would I be better of using another way of storing this information, like an ArrayList or something? I just need to use it as a datasource for a datalist (w/datakeys), and it's nice to be able to reference column names when I'm using databinding expressions.
Thanks in advance! I'm probably misunderstanding a major concept somewhere, so feel free to point out the obvious!
see inline

Signature
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
>Is it better to store this information in a DataTable or a DataSet?
It depends. A dataset is a collection of datatables. A datatable is a
collection of rows and columns.
The dataset has more overhead and is *fatter (for transmission purposes)
than the datatable but this overhead allows for easier management and added
functionality. A dataset also has a higher level of abstraction compared to
a datatable or an array list which makes it more suitable for component
development in n-tired situations.
>Whether this is true or not - does it make it harder for the cache to
>manage itself if you have a DataSet containing multiple tables in cache as
>opposed to individual DataTables
The cache doesn't concern itself with the type of data it stores. It just
needs to be serializable
and able to fit in memory.
> - for memory management, won't cache have to remove the entire DataSet if
> resources run low, as opposed dropping individual DataTables?
The cache removes objects. If it is a dataset the entire dataset goes, if it
is a table, the entire table goes.
>And I suppose the last question I should ask is: Would I be better of using
>another way of storing this information, like an ArrayList or something?
An arraylist is fine. But notice, the simpler data structure u use the less
functionality and manageability you have. For example, an array list does
not have the ability to manage thru rows and columns.
>I just need to use it as a datasource for a datalist (w/datakeys), and it's
>nice to be able to reference column names when I'm using databinding
>expressions.
Choose your datastructure according to the application purpose and project
requirements and not necessarily based on convention.