473,805 Members | 2,143 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 7420
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
2380
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
5281
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
2593
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
12487
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
24640
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
5878
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
1594
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
25971
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
2079
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
10363
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
10368
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,...
0
10107
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9186
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7649
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
6876
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();...
0
5544
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5678
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4327
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

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.