473,672 Members | 2,632 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Hashtable, key-value-pair (string)

Does there exist a class similar to a hashtable which provides a key-value
pair collection. The key and the value has to be a string?
Jul 19 '05 #1
3 7413
Hi,

take a look at:
System.Collecti ons.Specialized .HybridDictiona ry

Keys and Values are both objects. But all in DotNET is an object. So you can
pass a string in it.

cu
Bjoern Wolfgardt

<ol**********@z urich.ch> schrieb im Newsbeitrag
news:3f******@n ews.zurich-datacenter.com. ..
Does there exist a class similar to a hashtable which provides a key-value
pair collection. The key and the value has to be a string?

Jul 19 '05 #2
Oliver,
System.Collecti ons.Specialized .StringDictiona ry is a HashTable where the key
& value are string.

System.Collecti ons.Specialized .NameValueColle ction is an ordered HashTable
where the key & value are string.

Both System.Collecti ons & System.Collecti ons.Specialized have other
collection classes and base collection classes that you can use or use to
build your own collections.

Hope this helps
Jay

<ol**********@z urich.ch> wrote in message
news:3f******@n ews.zurich-datacenter.com. ..
Does there exist a class similar to a hashtable which provides a key-value
pair collection. The key and the value has to be a string?

Jul 19 '05 #3
Hi,

it is a specialized class. You don't have to care about how big the
collection will become. It will switch to ListDictonary if the Collection is
small and if it becomes bigger it will switch to Hashtable.
But I didn't remember that there is a collection that uses strings as values
and keys. So look at Jays answer.

cu
Bjoern Wolfgardt

<ol**********@z urich.ch> schrieb im Newsbeitrag
news:3f******** @news.zurich-datacenter.com. ..
What's the difference between the class Hashtable and System.Collecti ons.Specialized .HybridDictiona ry? Both use objects for key's
and value's.
Oliver

Jul 19 '05 #4

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

Similar topics

2
2376
by: Alfonso Morra | last post by:
I am implementing an application which requires the storage of a large number of items in a cache. I have 3-tuple key reprented by a struct, as well as an n-tuple (n is fixed) dataset, also represented by a struct. At run time, I will no exactly the number of items in the hashtable (I will have populated it myself by loading the data from a database). During the course of the applications lifetime, I will retrieve data in the hashtable...
4
5267
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: Exception of type System.Web.HttpUnhandledException was thrown. ---> System.InvalidOperationException: Hashtable insert failed. Load factor too high. at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add)
1
443
by: Derrick | last post by:
I'm seeing what looks like a leak with Hashtable, but guessing it is something I'm doing - void func1() { Hashtable hash = getHash(); //Loop thru assorted data, check to see if data exists as key in hashtable.
2
2588
by: Wamiq Ansari | last post by:
Hi, I am using a System.Windows.Forms.Label object as key in my Hashtable. One thing that has surprised me is that if I create two Label objects with same properties (ie. Name, TabIndex,Text,Size,Dock) and use them as Key in my Hashtable it doesn't give any error. I thought, generally, in a Hashtable we cannot use two same objects as keys. The Label Objects in this case are being created in a loop and used as keys in a Hashtable.
5
12483
by: Matthias Kwiedor | last post by:
Hi! What i want to do, is to put an ArrayList into a Hashtable. So i can access the ArrayList fast over the key-indexing of the Hashtable. What i did is to put the ArrayList into the Hashtable hash = arraylist
2
24627
by: MFRASER | last post by:
How do I go about looping through a hash table and removing items. I know how do this in a collectionbase, but can't iterate through the hash table with out getting an error. Here is my sample code for a collection base for(int i = this.Values.Count; i > 0 ; i--) { //Set local object
3
5875
by: Frank | last post by:
Hi! I'm kinda stuck here. I have an Hashtable with with my custom "Item" Object. The key used in the Hashtable is the "Item.Id", i have selected this key because with a lot of functions i can get the right object from the hashtable really fast. But now i need a function whom can get an object from the hashtable based on the values each "Item" object holds. ("Item.ColorId","Item.SizeId","Item.OtherId"), but i can't identify the object...
8
1588
by: JackRazz | last post by:
Is it possible to create a hashtable that doesn't store the key? I have a very large hashtable and I just want it to store the HashCode and the Value (two Int16s). Thanks - JackRazz
4
25914
by: Nadav | last post by:
Hello. I have a Hashtable, to which I insert key and values. When I go over the hashtable with "foreach" later on, the items are not coming out at the order I inserted them. A quickwatch showed that as the items are inserted, they are not arranged in the hash at the order they were inserted by. Is there a way to control that with a hashtable ? I can't even sort it... Thanks
8
2072
by: Martin Pöpping | last post by:
Hello, I´ve implemented a Hashtable with Int-Keys and Double Values. Now I want to get the i-th Int-Key of my hashtable. How do I do that? I tried it like that: ICollection intKeys = myHashtable.Keys;
0
8486
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8404
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8931
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8828
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8608
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6238
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5705
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2819
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 we have to send another system
2
2063
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.