/admin

Vpp Connection Hash Table

There are a bewildering array (excuse the pun) of data storage structures available to you in Visual Basic. Choose from arrays, ArrayLists, SortedLists, Dictionaries, HashTables, Lists and DataTables, among others. The Hashtable class represents a collection of key-and-value pairs that are organized based on the hash code of the key. It uses the key to access the elements in the collection. A hashtable is used when you need to access elements by using key, and you can identify a useful key value.Each item in the hashtable has a key/value pair.

  • VB.Net Basic Tutorial
  • VB.Net Advanced Tutorial
  • VB.Net Useful Resources
  • Selected Reading

The Hashtable class represents a collection of key-and-value pairs that are organized based on the hash code of the key. It uses the key to access the elements in the collection.

A hashtable is used when you need to access elements by using key, and you can identify a useful key value. Each item in the hashtable has a key/value pair. The key is used to access the items in the collection.

Properties and Methods of the Hashtable Class

The following table lists some of the commonly used properties of the Hashtable class −

Sr.No.Property & Description
1

Count

Gets the number of key-and-value pairs contained in the Hashtable.

2

IsFixedSize

Gets a value indicating whether the Hashtable has a fixed size.

3

IsReadOnly

Gets a value indicating whether the Hashtable is read-only.

4

Pes ukuran kecil pc. Item

Gets or sets the value associated with the specified key.

5

Keys

Gets an ICollection containing the keys in the Hashtable.

6

Values

Gets an ICollection containing the values in the Hashtable.

The following table lists some of the commonly used methods of the Hashtable class −

Sr.No.Method Name & Purpose
1

Public Overridable Sub Add (key As Object, value As Object )

Adds an element with the specified key and value into the Hashtable.

2

Public Overridable Sub Clear

Removes all elements from the Hashtable.

3

Public Overridable Function ContainsKey (key As Object) As Boolean

Determines whether the Hashtable contains a specific key.

4

Public Overridable Function ContainsValue (value As Object) As Boolean

Determines whether the Hashtable contains a specific value.

5

Public Overridable Sub Remove (key As Object)

Removes the element with the specified key from the Hashtable.

Example

The following example demonstrates the concept −

When the above code is compiled and executed, it produces the following result −

vb.net_collections.htm