473,320 Members | 1,977 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Use a DataTable in place of a HashTable

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.
Nov 15 '05 #1
3 2889
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_" <_n****@nomail.com> wrote in message
news:pe********************************@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.

Nov 15 '05 #2
>"_eee_" <_n****@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.

Nov 15 '05 #3
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_" <_n****@nomail.com> wrote in message
news:h5********************************@4ax.com...
"_eee_" <_n****@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.

Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: MrMike | last post by:
I have the following code which allows me to display records from a table named "lkup_Specie" in a datagrid. If I create a second datatable and a second hashtable for a table named "lkup_Grade",...
1
by: M | last post by:
My problem is that AutogenerateColumns="false" does not work with the datatable I built from a hashtable. (Please don't ask why I'm pulling data from a database, putting it in a hashtable, then...
1
by: MrMike | last post by:
I have the following code which allows me to display records from a table named "lkup_Specie" in a datagrid. If I create a second datatable and a second hashtable for a table named "lkup_Grade",...
4
by: =?Utf-8?B?UmljaA==?= | last post by:
Hello, In my vb2005 app I create 3 datatables in the Datasource area, tbl1, tbl2, tbl3. tbl1 contains 1 column, tbl2 contains 2 columns tbl3 contains 3 columns. Based on selections from a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.