Marcin,
Thats exactly what I'm trying to do, but with a difference. The keys I'm passing in
are all at least 5 chars long and sometimes they are phrases of 25 characters. If I
had say 400,000 items in a hashtable, the key would impact memory heavily. I was
simply trying to use a hashtable, with the hash code only being stored, not the key
due to its memory impact. I'm a bit new to hashtables, so I was thinking that this
might be possible (perfect hashing), but it doesn't like it is, unless I knew the
keys at design time (like say keywords in a compiler).
Anyhow, I'm moving on for now using the .net hashtable, with the key stored. In 15
years, there will probably be the perfect hash that doesn't care how many cycles are
used, etc
Thanks for the help - JackRazz
| Hi JackRazz,
|
| > Marcin,
| > I wanted to store two int16's as the values where the key is a string.
|
| Hmmm... maybe i missed something.
|
| // but try this:
| string key="myKey";
| short[] twoShorts=new short[2];
| twoShorts[0]=1;
| twoShorts[1]=11;
|
| hashTable.Add(key, twoShorts);
|
| // so you can get those shorts by:
| short[] tempShorts=hashTable["myKey"];
|
| > I'm new to
| > hashtables and was hoping for the almost perfect hashtable that didn't require me
to
| > store the key, but I now see the impossiblity of what I wanted to do.
|
| Hmmm... i don't what do you expect from hashtable, but i think
| that you should look up the other .NET collection.
|
| HTH
| Marcin