By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,666 Members | 1,373 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,666 IT Pros & Developers. It's quick & easy.

Hashtable.Item property

P: n/a
Hi:

I've tried to use Hashtable.Item property, which should
return a value according to the key assigned. But it
returns an error saying the function does not exist in the
class (it did not show up under intellisense either when I
typed in the letter). Can someone tell me if this is a
bug and how do I fix that?

Andrew
Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a

"Andrew Chen" <ac***@superteltech.com> wrote in message
news:08****************************@phx.gbl...
Hi:

I've tried to use Hashtable.Item property, which should
return a value according to the key assigned. But it
returns an error saying the function does not exist in the
class (it did not show up under intellisense either when I
typed in the letter). Can someone tell me if this is a
bug and how do I fix that?

Andrew


The Hashtable.Item() property is an indexer. In C# indexers are accessed
using an array-like syntax:

Hashtable h = new Hashtable();
h["somekey"] = "somevalue";
Console.WriteLine( h["somekey"]);

For languages (like VB.NET) that do not support a special syntax for
indexers, the name is made available:

Dim h as new Hashtable()
h.Item( "somekey") = "somevalue"
Console.WriteLine( h.Item( "somekey"))

--
MikeB
Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.