what is hash table

Answer Posted / kumaresh

1.Hashtable is a class which falls into System.Collections
namespace.
you can create object for hashtable. For example,
Hashtable hash = new Hashtable();

2.Key and value should be added to hashtable. For example,
hash.Add(1,"God");
hash.Add(2,"Human");

3.The key, value will be sorted automatically based on the
Hashcode generated[this operation is taken care by CLR].

4.GetHashCode() method is used to get the generated hashcode

5.While retrieving the hashtable values, you can use the
key tp retrieve the values. For example
foreach (DictionaryEntry item in hashTable)
{
Console.WriteLine("Key is {0}, Value is
{1}", item.Key,item.Value);
}
NOTE: if you add the same key into the hastable, it will
not throw any compliation error, but during runtime, it
will throw "ArgumentException" error.

Is This Answer Correct ?    19 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the source of constraints?

512


Explain encryption of entire databases without the need for application changes in sql server 2008?

566


Explain about nested stored procedure?

608


What is exporting utility?

544


What does man by sql wildcard characters in sql server?

527






How do I view a trc file?

507


Write an sql query to sort a table according to the amounts in a row and find the second largest amount.

568


How to create a local temporary stored procedure?

503


hi, how to link a text file and a .rpt file in my tables of sql server and to retrieve those records for further use. reply me as soon as possible.

1562


Why variables called the most powerful component of ssis?

595


Explain linked server in sql?

698


what is the sql equivaent of the dataset relation object ?

1573


Can you pass expressions to function parameters?

546


What happens if null values are involved in string operations?

560


Explain tablesample?

556