Hashtable Key Limit

  • Thread starter Thread starter MFRASER
  • Start date Start date
M

MFRASER

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.
 
MFRASER said:
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.

Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.

There should be no problem using strings of any length.
 
Back
Top