Hashtable Item
-
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
-
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
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];
-
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
The
Item
property ofHashTable
is the indexer in C#. You access it using this syntax: object val = myHash[objKey]; Charlie if(!curlies){ return; }