Module Module1
Sub Main()
Dim array() As String = {"VB.NET", "Java", "PHP", "C#", "C++"}
Dim dic As Dictionary(Of String, Integer) = array.ToDictionary(Function(s As String)
Return s
End Function,
Function(s As String)
Return s.Length
End Function)
For Each item As KeyValuePair(Of String, Integer) In dic
Console.WriteLine("{0} : {1}", item.Key, item.Value)
Next
End Sub
End Module
' run:
'
' VB.NET : 6
' Java: 4
' PHP: 3
' C#: 2
' C++ : 3