How do you add objects to hashtable

A) With Add method
B) With insert Method
C) With = operator

Showing Answers 1 - 10 of 10 Answers

Mike K

  • Mar 5th, 2006
 

Actually operator "=" adds an element too.

The following example adds key-value

pair "x"-"value" to Hashatble h:

HashTable h = new HashTable();

h("x") = "value";

  Was this answer useful?  Yes

Leo

  • Mar 7th, 2006
 

Key/value pairs are accessed via indexer:Hashtable table = new Hashtable();table[key] = value;

  Was this answer useful?  Yes

Ashish

  • Feb 5th, 2007
 

object in the Hash table can be add with the add method as well as with "=" also.Hashtable h =new Hash Table()h.add(Key,Value)orh(Key)=valueThanks

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions