|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
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 - 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 Show quote "Joseph Geretz" <jgeretz@nospam.com> wrote in message news:%23ZQYOMKbHHA.1296@TK2MSFTNGP02.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 - > Hi Kevin,
> Array of strings? Will this provide as efficient lookup as the HashTable?Thanks, - Joseph Geretz - Show quote "Kevin Spencer" <unclechut***@nothinks.com> wrote in message news:O858PPKbHHA.4220@TK2MSFTNGP03.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" <jgeretz@nospam.com> wrote in message > news:%23ZQYOMKbHHA.1296@TK2MSFTNGP02.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 - >> > > On Mar 22, 4:54 pm, "Joseph Geretz" <jger...@nospam.com> wrote: So basically you want a set, right? No, there's nothing built into the> 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, "". framework. Normally people just use HashTable/Dictionary<K,V> and use a dummy value. Jon 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] - mvp@spam.guard.caspershouse.com Show quote "Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message news:1174583295.016401.78460@l77g2000hsb.googlegroups.com... > On Mar 22, 4:54 pm, "Joseph Geretz" <jger...@nospam.com> 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, "". > > So basically you want a set, right? No, there's nothing built into the > framework. Normally people just use HashTable/Dictionary<K,V> and use > a dummy value. > > Jon > Nicholas Paldino [.NET/C# MVP] <mvp@spam.guard.caspershouse.com> wrote:
> It might be a little early, but there will be the HashSet class in Orcas Hurrah! Only 5 years after it should have been present :)> which will introduce this class. Just something to be aware of in the > future. -- Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet If replying to the group, please do not mail me too I can't wait. :-)
Peter -- Site: http://www.eggheadcafe.com UnBlog: http://petesbloggerama.blogspot.com Short urls & more: http://ittyurl.net Show quote "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] > - mvp@spam.guard.caspershouse.com > > "Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message > news:1174583295.016401.78460@l77g2000hsb.googlegroups.com... > > On Mar 22, 4:54 pm, "Joseph Geretz" <jger...@nospam.com> 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, "". > > > > So basically you want a set, right? No, there's nothing built into the > > framework. Normally people just use HashTable/Dictionary<K,V> and use > > a dummy value. > > > > Jon > > > > > On Mar 22, 12:45 pm, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.com> wrote: > It might be a little early, but there will be the HashSet class in Orcas I was not aware of that until now. I'm guessing it'll have union,> which will introduce this class. Just something to be aware of in the > future. > > -- > - Nicholas Paldino [.NET/C# MVP] > - m...@spam.guard.caspershouse.com > intersection, difference, etc. methods? That would be nice. Thanks for the tip. 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 An array?> 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 - Hi Rad,
> An array? Will this provide as efficient lookup as the HashTable?Thanks, - Joseph Geretz - Show quote "Rad [Visual C# MVP]" <nospam@nospam.com> wrote in message news:4mwnai36wsnt$.dlg@thinkersroom.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 > No, HashTable is your fastest lookup hands down. Just put an INT in the >> An array? > > Will this provide as efficient lookup as the HashTable? > data with 0. Then you can just use the keys. EmeraldShield <emeraldshield@noemail.noemail> wrote:
> No, HashTable is your fastest lookup hands down. Just put an INT in the Using a plain HashTable, that's a really bad idea - the 0 would get > data with 0. Then you can just use the keys. boxed every time. Using something like "" or even making the key also the value is more efficient. -- Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet If replying to the group, please do not mail me too Thanks Jon,
I've been using "" for the value. - Joe Geretz - Show quote "Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message news:MPG.206d0de5c0a95f6998da01@msnews.microsoft.com... > EmeraldShield <emeraldshield@noemail.noemail> wrote: >> No, HashTable is your fastest lookup hands down. Just put an INT in the >> data with 0. Then you can just use the keys. > > Using a plain HashTable, that's a really bad idea - the 0 would get > boxed every time. Using something like "" or even making the key also > the value is more efficient. > > -- > Jon Skeet - <sk***@pobox.com> > http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet > If replying to the group, please do not mail me too > Will this provide as efficient lookup as the HashTable? What are you trying to look up?-- HTH, Kevin Spencer Microsoft MVP Printing Components, Email Components, Networking Components, Controls, much more. DSI PrintManager, Miradyne Component Libraries: http://www.miradyne.net Show quote "Joseph Geretz" <jgeretz@nospam.com> wrote in message news:uCXGR$LbHHA.3616@TK2MSFTNGP05.phx.gbl... > Hi Rad, > >> An array? > > Will this provide as efficient lookup as the HashTable? > > Thanks, > > - Joseph Geretz - > > "Rad [Visual C# MVP]" <nospam@nospam.com> wrote in message > news:4mwnai36wsnt$.dlg@thinkersroom.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 > > How about a StringDictionary?
http://msdn2.microsoft.com/en-us/library/system.collections.specialized.stringdictionary_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 Show quote "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 - > > > |
|||||||||||||||||||||||