Hashtable, key-value-pair (string)

O

oliver.wulff

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?
 
J

Jay B. Harlow [MVP - Outlook]

Oliver,
System.Collections.Specialized.StringDictionary is a HashTable where the key
& value are string.

System.Collections.Specialized.NameValueCollection is an ordered HashTable
where the key & value are string.

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

Hope this helps
Jay
 
B

Bjoern Wolfgardt

Hi,

take a look at:
System.Collections.Specialized.HybridDictionary

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

cu
Bjoern Wolfgardt
 
B

Bjoern Wolfgardt

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



What's the difference between the class Hashtable and
System.Collections.Specialized.HybridDictionary? Both use objects for key's
and value's.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top