Not sure I understand. GetHashCode returns an int regardless of length.
Does this help?
Hashtable ht = new Hashtable();
ht.Add("This is my very long string key", "one");
ht.Add("This is small", "two");
ht.Add("This", "three");
foreach(string s in ht.Keys)
{
Console.WriteLine("Key:"+s);
}
Console.WriteLine("Value:" + ht["This is my very long string key"]);
If not, please supply small sample of code that shows your issue. Cheers!
--
William Stacey, MVP
"MFRASER" <mf*****@henwoodenergy.com> wrote in message
news:uo**************@TK2MSFTNGP10.phx.gbl...
Is there a limit to the size of a key for a Hashtable. I am adding items
to a hashtable using a string for the key and it seems that when my key is 16
characters long the indexer does not work properly. If I truncate the key
to be 12 characters the indexer works.
Also is there a better way to build a key for a string, should I convert
the string to a numeric value then add it?
and if so how do I go about converting a string to a numeric value.