I have been using a HashTable to store name/value pairs, but now I
need to add a third element (name/value/flag). I still need to be
able to index by ["Name"], and I'd like to keep lookup speed as high
as possible.

I'm considering using a DataTable instead of the HashTable since I
have to store the values to a database eventually anyway. It seems
like the DataTable can do what the HashTable is doing in this case,
but I'm concerned about efficiency.

Does anyone happen to know the tradeoffs in using the DataTable
instead? I was originally considering building both tables at the
same time, but that seems unnecessary.

Re: Use a DataTable in place of a HashTable by Miha

Miha
Thu Mar 04 04:56:44 CST 2004

Hi,

You might create a custom value class that encapsulates value and flag?
Using a DataTable seems a bit of an overkill to me.

--
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

"_eee_" <_notme@nomail.com> wrote in message
news:pe1e409u9rknaqfb67nh2a8freqlcvo1hh@4ax.com...
> I have been using a HashTable to store name/value pairs, but now I
> need to add a third element (name/value/flag). I still need to be
> able to index by ["Name"], and I'd like to keep lookup speed as high
> as possible.
>
> I'm considering using a DataTable instead of the HashTable since I
> have to store the values to a database eventually anyway. It seems
> like the DataTable can do what the HashTable is doing in this case,
> but I'm concerned about efficiency.
>
> Does anyone happen to know the tradeoffs in using the DataTable
> instead? I was originally considering building both tables at the
> same time, but that seems unnecessary.



Re: Use a DataTable in place of a HashTable by _eee_

_eee_
Thu Mar 04 14:36:14 CST 2004

>"_eee_" <_notme@nomail.com> wrote in message
>> I have been using a HashTable to store name/value pairs, but now I
>> need to add a third element (name/value/flag). I still need to be
>> able to index by ["Name"], and I'd like to keep lookup speed as high
>> as possible.
>>
>> I'm considering using a DataTable instead of the HashTable since I
>> have to store the values to a database eventually anyway.

On Thu, 4 Mar 2004 11:56:44 +0100, "Miha Markic [MVP C#]" <miha at
rthand com> wrote:
>
>You might create a custom value class that encapsulates value and flag?
>Using a DataTable seems a bit of an overkill to me.

Hi Miha,

You mean slow runtime? I could live with the increased code
complexity of the DataTable as long as it doesn't slow runtime down to
a crawl.


Re: Use a DataTable in place of a HashTable by Miha

Miha
Fri Mar 05 02:48:38 CST 2004

Yes, I mean that DataTable has overheads.
Rather use the "holder" class approach.

--
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

"_eee_" <_notme@nomail.com> wrote in message
news:h54f40hq5leu76c1ehpbj6gs1fqk0d93ec@4ax.com...
> >"_eee_" <_notme@nomail.com> wrote in message
> >> I have been using a HashTable to store name/value pairs, but now I
> >> need to add a third element (name/value/flag). I still need to be
> >> able to index by ["Name"], and I'd like to keep lookup speed as high
> >> as possible.
> >>
> >> I'm considering using a DataTable instead of the HashTable since I
> >> have to store the values to a database eventually anyway.
>
> On Thu, 4 Mar 2004 11:56:44 +0100, "Miha Markic [MVP C#]" <miha at
> rthand com> wrote:
> >
> >You might create a custom value class that encapsulates value and flag?
> >Using a DataTable seems a bit of an overkill to me.
>
> Hi Miha,
>
> You mean slow runtime? I could live with the increased code
> complexity of the DataTable as long as it doesn't slow runtime down to
> a crawl.
>