GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Microsoft  >  C#
Go To First  |  Previous Question  |  Next Question 
 C#  |  Question 290 of 436    Print  
How do you add objects to hashtable
A) With Add method
B) With insert Method
C) With = operator



  
Total Answers and Comments: 6 Last Update: January 16, 2008   
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
January 05, 2006 08:25:39   
sahu Member Since: December 2005   Contribution: 323    

RE: How do you add objects to hashtable

ans:

A) With Add method


 
Is this answer useful? Yes | No
January 07, 2006 08:54:44   
naveentej Member Since: January 2006   Contribution: 25    

RE: How do you add objects to hashtable

ans: Using Add method

Note: For arraylist collection we can use Add and Insert methods


 
Is this answer useful? Yes | No
March 05, 2006 22:57:59   
Mike K        

RE: How do you add objects to hashtable

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 ;


 
Is this answer useful? Yes | No
March 07, 2006 22:46:09   
Leo        

RE: How do you add objects to hashtable
Key/value pairs are accessed via indexer:Hashtable table new Hashtable();table[key] value;
 
Is this answer useful? Yes | No
February 05, 2007 01:19:06   
Ashish        

RE: How do you add objects to hashtable
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
 
Is this answer useful? Yes | No
January 16, 2008 00:26:40   
Kal_CSharp Member Since: January 2008   Contribution: 7    

RE: How do you add objects to hashtable
See the example here:

Hashtable ht new Hashtable();

ht.Add(0 "Kals");ht.Add(1

"Kal");

(or)

ht[0] "ABC";

ht[1] "XYZ";


 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2010 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape