Hashtable, key-value-pair (string)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • oliver.wulff@zurich.ch

    #1

    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?
  • Bjoern Wolfgardt

    #2
    Re: Hashtable, key-value-pair (string)

    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

    <oliver.wulff@z urich.ch> schrieb im Newsbeitrag
    news:3f2bc89d@n ews.zurich-datacenter.com. ..[color=blue]
    > 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?[/color]


    Comment

    • Jay B. Harlow [MVP - Outlook]

      #3
      Re: Hashtable, key-value-pair (string)

      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

      <oliver.wulff@z urich.ch> wrote in message
      news:3f2bc89d@n ews.zurich-datacenter.com. ..[color=blue]
      > 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?[/color]


      Comment

      • Bjoern Wolfgardt

        #4
        Re: Antwort: Re: Hashtable, key-value-pair (string)

        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



        <oliver.wulff@z urich.ch> schrieb im Newsbeitrag
        news:3f2cdcfe$1 @news.zurich-datacenter.com. ..[color=blue]
        > What's the difference between the class Hashtable and[/color]
        System.Collecti ons.Specialized .HybridDictiona ry? Both use objects for key's
        and value's.[color=blue]
        >
        > Oliver[/color]


        Comment

        Working...