Posted By

blackf0rk on 03/12/09


Tagged

key loop Value Generic dictionary access


Versions (?)

Use a Generic Dictionary


 / Published in: VB.NET
 

URL: http://codefinds.blogspot.com/2008/12/use-generic-dictionary.html

  1. ' Declaring a generic dictionary; adding values.
  2. ' Where the Key and Value (String, String) can be any object.
  3.  
  4. Dim xGD As New Generic.Dictionary(Of String, String)
  5. xGD.Add("key1", "value1")
  6.  
  7. ' Getting access to a value:
  8.  
  9. Dim value as String = xGD("key1")
  10.  
  11. ' Looping:
  12.  
  13. For Each xKVP As Generic.KeyValuePair(Of String, String) In xGD
  14. Consoe.Writeline(xKVP.Key & ", " & xKVP.Value)
  15. Next

Report this snippet  

You need to login to post a comment.