| Author: Abhishek Arya 11 Jun 2007 | Member Level: Diamond | Rating:  Points: 2 |
you can use kb in dotnetspider about hash tables
http://www.dotnetspider.com/qa/Question49436.aspx
|
| Author: Durga Prasad 11 Jun 2007 | Member Level: Gold | Rating:  Points: 2 |
this url will help u http://www.sparknotes.com/cs/searching/hashtables/section1.html
|
| Author: Shiva SaiRam 11 Jun 2007 | Member Level: Diamond | Rating:  Points: 2 |
Hashtable is useful when you need to store data in a key and value pair.
private Hashtable hshTable = new Hashtable();
Adding Items to a Hashtable
Add method of Hashtable is used to add items to the hashtable. The method has index and value parameters. The following code adds three items to hashtable.
hshTable .Add("Author1", "Shiva"); hshTable .Add("Author2", "Sai"); hshTable .Add("Author3", "Ram");
Retrieving an Item Value from Hashtable:
The following code returns the value of "Author1" key:
string strAuthor1 = hshTable["Author1"].ToString();
Removing Items from a Hashtable
The Remove method removes an item from a Hashtable. The following code removes item with index "Author1" from the hashtable:
hshTable.Remove("Author1");
Looking through all Items of a Hashtable
The following code loops through all items of a hashtable and reads the values.
// Loop through all items of a Hashtable IDictionaryEnumerator enumVar = hshTable.GetEnumerator(); while (enumVar.MoveNext()) { Response.Write(enumVar.Value.ToString() + " " ); }
|
| Author: sundarakshi 11 Jun 2007 | Member Level: Bronze | Rating:  Points: 2 |
A Hashtable is collection of values are stored with key,value.
(Eg) Hashtable h = new Hashtable(); h.Add("Key1", "Value1"); h.Add("Key2", "Value2"); h.Add("Key3", "Value3"); h.Add("Key4", "Value4"); h.Add("Key5", "Value5");
Getting Value From Hashtable Console.WriteLine(h.Item("Key3"));
By Issusing the key we can get the values
Regards Somu somushan@yahoo.com
|
| Author: ChandraShekar Thota 11 Jun 2007 | Member Level: Diamond | Rating:  Points: 2 |
view state data can be stored in hash table
Chandra Shekar Thota Microsoft MVP DNS is Y(Our) Site.Please work more on it to make it Worlds Best Technical Site chandrashekarthota@gmail.com
|
| Author: ChandraShekar Thota 11 Jun 2007 | Member Level: Diamond | Rating:  Points: 2 |
we can store values in key value pairs
Chandra Shekar Thota Microsoft MVP DNS is Y(Our) Site.Please work more on it to make it Worlds Best Technical Site chandrashekarthota@gmail.com
|
| Author: ChandraShekar Thota 11 Jun 2007 | Member Level: Diamond | Rating:  Points: 2 |
private Hashtable hshTable = new Hashtable();
Adding Items to a Hashtable
Add method of Hashtable is used to add items to the hashtable. The method has index and value parameters. The following code adds three items to hashtable.
hshTable .Add("Author1", "Shiva"); hshTable .Add("Author2", "Sai"); hshTable .Add("Author3", "Ram");
Chandra Shekar Thota Microsoft MVP DNS is Y(Our) Site.Please work more on it to make it Worlds Best Technical Site chandrashekarthota@gmail.com
|
| Author: Altaf Hussain 11 Jun 2007 | Member Level: Gold | Rating:  Points: 2 |
Hi
The hashtable will be faster comparing to array, because hashtable retrives the record randomly, It means the objects may not come out from the HashTable in the same order as you put them in.
eg
private Hashtable htable = new Hashtable();
htable.Add("one","Yahoo"); htable.Add("Two","Google"); htable.Add("three","orkut"); htable.Add("four","Naukri");
IDictionaryEnumerator enumVar = htable.GetEnumerator(); while (enumVar.MoveNext()) { MessageBox.Show(enumVar.Value.ToString() + " " ); }
output
1 orkut 2 Naukri 3 Google 4 Yahoo
the purpose may be retrieve faster,
|