473,569 Members | 2,634 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Any such thing as a single column HashTable?

Basically, I just need an efficient way to store and retrieve keys from a
list. I don't need key/value pairs. I've implemented this with the standard
HashTable, but the value column is a waste since every key has the same
value, "".

Thanks for your advice.

- Joe Geretz -
Mar 22 '07 #1
14 1368
Array of strings?

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
Networking Components, Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net

"Joseph Geretz" <jg*****@nospam .comwrote in message
news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
Basically, I just need an efficient way to store and retrieve keys from a
list. I don't need key/value pairs. I've implemented this with the
standard HashTable, but the value column is a waste since every key has
the same value, "".

Thanks for your advice.

- Joe Geretz -

Mar 22 '07 #2
On Mar 22, 4:54 pm, "Joseph Geretz" <jger...@nospam .comwrote:
Basically, I just need an efficient way to store and retrieve keys from a
list. I don't need key/value pairs. I've implemented this with the standard
HashTable, but the value column is a waste since every key has the same
value, "".
So basically you want a set, right? No, there's nothing built into the
framework. Normally people just use HashTable/Dictionary<K,Va nd use
a dummy value.

Jon

Mar 22 '07 #3
On Thu, 22 Mar 2007 12:54:49 -0400, Joseph Geretz wrote:
Basically, I just need an efficient way to store and retrieve keys from a
list. I don't need key/value pairs. I've implemented this with the standard
HashTable, but the value column is a waste since every key has the same
value, "".

Thanks for your advice.

- Joe Geretz -
An array?
--
Bits.Bytes
http://bytes.thinkersroom.com
Mar 22 '07 #4
Hi Kevin,
Array of strings?
Will this provide as efficient lookup as the HashTable?

Thanks,

- Joseph Geretz -

"Kevin Spencer" <un**********@n othinks.comwrot e in message
news:O8******** ******@TK2MSFTN GP03.phx.gbl...
Array of strings?

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
Networking Components, Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net

"Joseph Geretz" <jg*****@nospam .comwrote in message
news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
>Basically, I just need an efficient way to store and retrieve keys from a
list. I don't need key/value pairs. I've implemented this with the
standard HashTable, but the value column is a waste since every key has
the same value, "".

Thanks for your advice.

- Joe Geretz -


Mar 22 '07 #5
It might be a little early, but there will be the HashSet class in Orcas
which will introduce this class. Just something to be aware of in the
future.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Jon Skeet [C# MVP]" <sk***@pobox.co mwrote in message
news:11******** *************@l 77g2000hsb.goog legroups.com...
On Mar 22, 4:54 pm, "Joseph Geretz" <jger...@nospam .comwrote:
>Basically, I just need an efficient way to store and retrieve keys from a
list. I don't need key/value pairs. I've implemented this with the
standard
HashTable, but the value column is a waste since every key has the same
value, "".

So basically you want a set, right? No, there's nothing built into the
framework. Normally people just use HashTable/Dictionary<K,Va nd use
a dummy value.

Jon

Mar 22 '07 #6
Nicholas Paldino [.NET/C# MVP] <mv*@spam.guard .caspershouse.c omwrote:
It might be a little early, but there will be the HashSet class in Orcas
which will introduce this class. Just something to be aware of in the
future.
Hurrah! Only 5 years after it should have been present :)

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Mar 22 '07 #7
I can't wait. :-)
Peter
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Nicholas Paldino [.NET/C# MVP]" wrote:
It might be a little early, but there will be the HashSet class in Orcas
which will introduce this class. Just something to be aware of in the
future.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Jon Skeet [C# MVP]" <sk***@pobox.co mwrote in message
news:11******** *************@l 77g2000hsb.goog legroups.com...
On Mar 22, 4:54 pm, "Joseph Geretz" <jger...@nospam .comwrote:
Basically, I just need an efficient way to store and retrieve keys from a
list. I don't need key/value pairs. I've implemented this with the
standard
HashTable, but the value column is a waste since every key has the same
value, "".
So basically you want a set, right? No, there's nothing built into the
framework. Normally people just use HashTable/Dictionary<K,Va nd use
a dummy value.

Jon


Mar 22 '07 #8
How about a StringDictionar y?
http://msdn2.microsoft.com/en-us/lib...y_members.aspx

It still has that nasty Value member, but its strongly typed and has the
nice convenience lookup methods.
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Joseph Geretz" wrote:
Basically, I just need an efficient way to store and retrieve keys from a
list. I don't need key/value pairs. I've implemented this with the standard
HashTable, but the value column is a waste since every key has the same
value, "".

Thanks for your advice.

- Joe Geretz -
Mar 22 '07 #9
Hi Rad,
An array?
Will this provide as efficient lookup as the HashTable?

Thanks,

- Joseph Geretz -

"Rad [Visual C# MVP]" <no****@nospam. comwrote in message
news:4m******** *******@thinker sroom.com...
On Thu, 22 Mar 2007 12:54:49 -0400, Joseph Geretz wrote:
>Basically, I just need an efficient way to store and retrieve keys from a
list. I don't need key/value pairs. I've implemented this with the
standard
HashTable, but the value column is a waste since every key has the same
value, "".

Thanks for your advice.

- Joe Geretz -

An array?
--
Bits.Bytes
http://bytes.thinkersroom.com

Mar 22 '07 #10

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

Similar topics

4
8346
by: Anders Borum | last post by:
Hello! I have a list of singleton classes (model managers) that store objects internally using hashtables. Each of these classes use a single hashtable to store e.g. users, pages, elements and so on (I have complete control of the objects stored). I am currently using a set of abstract cache classes that my model managers subclass. The...
5
2814
by: francois | last post by:
First of all I would to to apologize for resending this post again but I feel like my last post as been spoiled Here I go for my problem: Hi, I have a webservice that I am using and I would like it to return an XML serialized version of an object.
5
15568
by: Cyrus | last post by:
I have a question regarding synchronization across multiple threads for a Hashtable. Currently I have a Threadpool that is creating worker threads based on requests to read/write to a hashtable. One function of the Hashtable is to iterate through its keys, which apparently is inherently not thread-safe. Other functions of the Hashtable...
33
3296
by: Ken | last post by:
I have a C# Program where multiple threads will operate on a same Hashtable. This Hashtable is synchronized by using Hashtable.Synchronized(myHashtable) method, so no further Lock statements are used before adding, removing or iterating the Hashtable. The program runs in a high workload environment. After running a few days, now it suddenly...
9
4031
by: Oberon | last post by:
My HashTable (Global.Games) is a static collection of objects of type Game. A Game object has 8 fields (exposed as properties). The key to the HashTable is also one of these fields (GameID, of type int). When I try to create a SortedList from the HashTable with the following: SortedList sortedGames = new SortedList(Global.Games); I get...
3
1479
by: Alexander Widera | last post by:
Hi, I have a problem with this code ... (see below) ... I want to sort an instance of MyList ... by MyData.Shortname ... Shortname is of the type string.... how can I sort the entries? Thank you for your help. Alex using System;
8
3925
by: Moondog | last post by:
I am referencing a datagrid item like this: strItemNo = grdItems.Item(grdItems.CurrentRowIndex(), 0) The Item Number is in the first column; column 0. It works fine except this is not a very good programming practice. What if someday someone decides to move the "item number" column to the fourth or fifth position?
2
3140
by: PAzevedo | last post by:
I have this Hashtable of Hashtables, and I'm accessing this object from multiple threads, now the Hashtable object is thread safe for reading, but not for writing, so I lock the object every time I need to write to it, but now it occurred to me that maybe I could just lock one of the Hashtables inside without locking the entire object, but...
2
1565
by: hharry | last post by:
Hello All, I have a single class windows service that includes a function that runs in the ThreadPool. The class contains a hashtable which is declared in the main thread. What is the recommended method of updating a variable declared in the main thread from a spawned threadpool thread ?
0
7615
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8130
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7677
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7979
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5514
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3643
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2115
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
940
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.