Reading value from Hashtable
I m very new to asp.net. Im developing a web site where I m using hash table to store the values. the sample code is something like this
Dim h1 As Hashtable
Dim h2 As Hashtable
Dim inte As Integer
Dim s1 As String
Dim s2 As String
Dim s3 As String
Dim ht As New Hashtable
h1 = New Hashtable
h1.Add(1, "N1")
h1.Add(2, "N2")
h1.Add(3, "N3")
h1.Add(4, "N4")
ht.Add("key", h1)
h1 = Nothing
h1 = New Hashtable
h1.Add(1, "N5")
h1.Add(2, "N6")
h1.Add(3, "N7")
h1.Add(4, "N8")
ht.Add("key1", h1)
h1 = Nothing
inte = ht.Count
Dim myEnumerator As IDictionaryEnumerator = ht.GetEnumerator()
While myEnumerator.MoveNext()
h1 = New Hashtable
s1 = myEnumerator.Key
h1 = myEnumerator.Value
Dim myEnumerator1 As IDictionaryEnumerator = h1.GetEnumerator()
While myEnumerator1.MoveNext()
s2 = myEnumerator1.Key
s3 = myEnumerator1.Value
End While
h1 = Nothing
End While
In the above code, I m adding on hashtable into another hash table. and I m using the enumerator to read the values. But right now I m looping thro the hash table to get the values.
I want to know if I can directly retrieve the value of a particular key from the hashtable instead of looping thro all the keys in the hashtable.
Thanking in advance

