Nice Info Parke ... thanx for sharing.
 
Would like to ask if you can share your thoughts,  would there be any 
specific benefits/advantage of using "System.Collections.Hashtable" over 
existing Dictionary objects may be in terms of memory saving or execution 
time ??
 
 
Cheers..
Rahul

On Monday, July 30, 2012 8:11:12 PM UTC+5:30, Parke wrote:

> We can use the hashtable from .Net within QTP and list the keys and 
> values 
>
> Set myHash = 
> DotnetFactory.CreateInstance("System.Collections.Hashtable") 
> Set myEnumerator = 
> DotnetFactory.CreateInstance("System.Collections.IDictionaryEnumerator") 
>
> myHash.add  "a", "apple" 
> myHash.add "o", "orange" 
> myHash.add  "r","red" 
> myHash.add "b", "blue" 
>
> Set myEnumerator = myHash.getEnumerator 
>
> ' using contains returns true or false 
> print "contains B " & myHash.Contains("B") 
> print "contains b " & myHash.Contains("b") 
> print "hash contains value red " & myHash.ContainsValue("red") 
> print "value for o = " & myHash.Item("o") 
> print "number of keys = " & myHash.count 
>
> While myEnumerator.movenext 
>         print "key " & myEnumerator.Key & ":: value " & myenumerator.value 
> Wend 
>
> Have fun playing with it. 
>
>
> Parke 
>

-- 
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en

Reply via email to