How to use dictionary in VB.NET

1 Answer

0 votes
Module Module1

    Sub Main()

        Dim dic As New Dictionary(Of Integer, String)

        dic.Add(1, "VB.NET")
        dic.Add(2, "Java")
        dic.Add(5, "c++")

        For Each item As KeyValuePair(Of Integer, String) In dic
            Console.WriteLine("{0} : {1}", item.Key, item.Value)
        Next

    End Sub

End Module

' run:
' 
' 1 : VB.NET
' 2: Java
' 5: c++

 



answered Sep 26, 2018 by avibootz
...