Go Back  Xtreme .NET Talk > .NET > Syntax Specific > Visual C# .NET > Hashtables - Item Method


Reply
 
Thread Tools Display Modes
  #1  
Old 08-24-2003, 05:14 PM
SEVI SEVI is offline
Freshman

Preferred language:
C#
 
Join Date: Jun 2003
Location: Australia
Posts: 48
SEVI is on a distinguished road
Default Hashtables - Item Method

Question: Does the hashtable class have an item method?

All documentation says it should. MSDN says it should, other sources confirm this. But I have not been able to use it, becuase it does not seem to be there !!

As I understand it I should be able to just create a hashtable and the method should be available as a member of h, below..

System.Collections.Hashtable h = new System.Collections.Hashtable();

I'm using C# 2003 and cannot fingure out what is going on. Can anyone shed some light on this?

Thanks
Reply With Quote
  #2  
Old 08-24-2003, 06:17 PM
wyrd's Avatar
wyrd wyrd is offline
Senior Contributor

Preferred language:
C#
 
Join Date: Aug 2002
Location: California
Posts: 1,408
wyrd is on a distinguished road
Default

Code:
using System.Collections;

Hashtable h = new Hashtable();

h.Add(key, value);
object o = h[key];

Should work.
__________________
Gamer extraordinaire. Programmer wannabe.
Reply With Quote
  #3  
Old 08-24-2003, 06:22 PM
mutant mutant is offline
Ultimate Contributor

Preferred language:
Any language
 
Join Date: Jan 2003
Location: Enfield, CT, USA
Posts: 1,771
mutant is on a distinguished road
Default

In C# Item property is an indexer.
Reply With Quote
  #4  
Old 08-24-2003, 09:35 PM
SEVI SEVI is offline
Freshman

Preferred language:
C#
 
Join Date: Jun 2003
Location: Australia
Posts: 48
SEVI is on a distinguished road
Default

Thank-you both..
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Best method hog Directory / File IO / Registry 7 07-24-2005 01:19 PM
Display the last Item Talk2Tom11 General 8 09-28-2004 12:03 AM
Byte to Item Jedhi General 1 02-18-2004 10:35 AM
Method name Phylum General 2 11-12-2003 03:17 PM
Listbox selected item rickb Database / XML / Reporting 9 07-02-2003 10:19 PM

Advertisement:

Powered by liquidweb