Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Hashtable Item

Hashtable Item

Scheduled Pinned Locked Moved C#
help
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • 3 Offline
    3 Offline
    3green
    wrote on last edited by
    #1

    I know I am doing something silly, but I cant seem to access the Item property of a Hastable: Hashtable myHash = new Hashtable(); myHash.Item; Produces a build error "System.Collections.Hashtable does not contain a definition for 'Item' " But it sez in help that Item is a public property of Hashtable. Am using VS2003 Enterprise with Frameworks 1.1 SP1 Many thanks

    B C 2 Replies Last reply
    0
    • 3 3green

      I know I am doing something silly, but I cant seem to access the Item property of a Hastable: Hashtable myHash = new Hashtable(); myHash.Item; Produces a build error "System.Collections.Hashtable does not contain a definition for 'Item' " But it sez in help that Item is a public property of Hashtable. Am using VS2003 Enterprise with Frameworks 1.1 SP1 Many thanks

      B Offline
      B Offline
      Brian Nottingham
      wrote on last edited by
      #2

      In C# the "Item" property is accessed using indexer syntax. So instead you would write something like this. Hashtable myHash = new Hashtable(); object value = myHash[key];

      1 Reply Last reply
      0
      • 3 3green

        I know I am doing something silly, but I cant seem to access the Item property of a Hastable: Hashtable myHash = new Hashtable(); myHash.Item; Produces a build error "System.Collections.Hashtable does not contain a definition for 'Item' " But it sez in help that Item is a public property of Hashtable. Am using VS2003 Enterprise with Frameworks 1.1 SP1 Many thanks

        C Offline
        C Offline
        Charlie Williams
        wrote on last edited by
        #3

        The Item property of HashTable is the indexer in C#. You access it using this syntax: object val = myHash[objKey]; Charlie if(!curlies){ return; }

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups