Reading value from Hashtable

Hi

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
[1747 byte] By [rahulvasanth] at [2007-11-19 14:03:25]
# 1 Re: Reading value from Hashtable
How about Hashtable.Item Property? You can retrieve the value for the specific key by using it.
columbus2003 at 2007-11-9 11:48:16 >
# 2 Re: Reading value from Hashtable
Item is the default property also so you can just use: ht("key1")
cmiskow at 2007-11-9 11:49:16 >