How to use Hashtable in

Total Post:341


 1462  View(s)
Rate this:
I want to use Hashtable  in how to use this please help me.
  1. Re: How to use Hashtable in

    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.

    Module Module1
        Sub Main()
            Dim ht As Hashtable = New Hashtable()
            Dim k As String
            ht.Add("001", "anupam singh")
            ht.Add("002", "sunil kumar")
            ht.Add("003", "vinay pawe")
            ht.Add("004", "arjun singh")
            ht.Add("005", "Manish Mishra")
            ht.Add("006", "Manoj Panday")
            ht.Add("007", "Sohel khan")
            If (ht.ContainsValue("Shiv chand")) Then
                Console.WriteLine("This student name is already in the list")
                ht.Add("008", "Shiv chand")
            End If
            ' Get a collection of the keys.
            Dim key As ICollection = ht.Keys
            For Each k In key
                Console.WriteLine(" {0} : {1}", k, ht(k))
            Next k
        End Sub
    End Module



Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.