473,473 Members | 1,483 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Hashtable Key Limit

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.
Jul 21 '05 #1
2 1853
MFRASER <mf*****@henwoodenergy.com> wrote:
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.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #2
see c# ng for answers.

--
William Stacey, MVP

"MFRASER" <mf*****@henwoodenergy.com> wrote in message
news:#s**************@TK2MSFTNGP11.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.


Jul 21 '05 #3

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

Similar topics

4
by: Gary Davis | last post by:
Once a day or so, I receive an error on a fairly active website that calls this StrMixed.cs method constructor. 99% of the time there is no exception: System.Web.HttpUnhandledException:...
2
by: MFRASER | last post by:
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...
5
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...
5
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....
33
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...
3
by: Fred | last post by:
I'm trying to build a hashtable and a arraylist as object value I'm not able to retrieve stored object from the hashtable. Hashtable mp = new Hashtable(); // THE HASHTABLE ArrayList...
2
by: MFRASER | last post by:
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...
2
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...
8
by: chrisben | last post by:
Hi, If I am not sure how many items will be in my Hashtable/ArrayList dynamically (multiple threads can add/remove/check the item), however, I can estimate the total number will not exceed...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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...
1
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
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 ...

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.