Javatpoint Logo
Javatpoint Logo

VB.NET HashTable

A HashTable is used to store the collection of different types of data in key-value pairs. These table data are organized based on the hash key. A HashTable is provided by the System.Collection namespace. A Key is used to identify and access each element of the HashTable because each item in the HashTable has a Key/value pair.

HashTable Properties

The following table describes the properties of the HashTable

Property Name Description
IsSynchronized It is used to obtain a value that determines whether the HashTable is synchronized.
IsFixedSize It is used to obtain a value that determines whether a HashTable has a fixed size.
Count It is used to count the number of key/value pair elements available in the HashTable.
IsReadOnly It is used to obtain a value that determines whether the HashTable is read-only.
Item It is used to get or set a value associated with the specified key.
Keys It is used to obtain a collection of keys in a HashTable.
Values It is used to obtain a collection of values in a HashTable.

HashTable Methods

The Following are the commonly used method of the HashTable in the VB.NET.

Methods Name Description
Add It is used to add an element with the specified key and value into the HashTable.
Syntax: HashTable.Add(key, value)
ContainsKey It is used to check whether the specified key exists or not in HashTable.
Syntax: HashTable.ContainsKey(key)
ContainsValue It is used to check whether the specified value of the key is existing or not in HashTable.
Syntax: HashTable.ContainsValue(value)
Remove The Remove function is used to remove the specified key with the corresponding value.
Syntax: HashTable.Remove(Key)
Clear It is used to remove all the elements from the HashTable.
GetHash A GetHash is used to get the hash code of the specified key in HashTable/

Let's create a program to understand the concept of HashTable in the VB.NET programming language.

Array_Hash.vb

Output:

VB.NET HashTable
Next TopicVB.NET Stack





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA