Not sure why it hasn't been offered but the HybridDictionary is a great space
saving device that switches from using an internal array and linear look-up to
using a Hashtable at a predefined performance tuned size. The class was
specifically built to improve performance of look-up and memory usage when
using lightly populated collections of name/value pairs. In context this would
automatically switch you to the most performant method depending on the
numbers of records rather than requiring large amounts of code.
To speak in the defense of the DataSet, it doesn't use XML until you serialize
it. You aren't wasting memory by using a DataSet at all. There is some small
extra overhead in using it because of extra properties about the data that are
stored but in general all you have is:
A DataSet, and you don't even have that unless you want one.
A DataTable - DataColumnCollection and DataRowCollection
DataColumnCollection - Consists of DataColumn's one for each
DataRowCollection - Consists of DataRow's one for each row
DataRow - int's that offset into DataStorage. Doesn't store values
DataColumn - Information about the actual column + a DataStorage element
that allows indexing by the DataRow into the internal storage.
StringStorage is the DataStorage override used and it has a string[] backing
store.
--
Justin Rogers
DigiTec Web Consultants, LLC.
Blog:
http://weblogs.asp.net/justin_rogers
"Doug" <ClubMott@Livermore.com> wrote in message
news:eCKe3WaeEHA.3348@TK2MSFTNGP09.phx.gbl...[color=blue]
> <<With fewer than 100 rows, you can have no valid objection to using a
> DataTable>>
>
> There might be this objection given the context in which this thing will be
> used: The context is that this structure (whatever I end up with) will exist
> in an ASP.NET Web Application Session state. So, start multiplying the
> "fewer than 100 rows" by the number of Sessions and suddenly size matters
> more and more as the number of Sessions increases.
>
> Perhaps I'm still wrong though. The unnecessary size I'm thinking of is the
> XML involved in storing this as a DataTable (I haven't measured the bytes
> involved, but we all know XML is verbose - more so than a 3d array or
> Hashtable - and DataTables are XML structures.).
>
> Thanks for the sample code on the Hashtable.
>
>[/color]