Mega Code Archive

 
Categories / VB.Net Tutorial / Collections
 

Dictionary(Of String, String)

Imports System.Collections.Generic Public Class GenericTest    Public Shared Sub Main()       Dim education As New Dictionary(Of String, String)       education.Add("BA", "Bachelor of Arts")       education.Add("BS", "Bachelor of Science")       education.Add("MA", "Master of Arts")       education.Add("MS", "Master of Science")       education.Add("MPhil", "Master of Philosophy")       education.Add("PhD", "Doctor of Philosophy")       Console.WriteLine(education.Item("BS"))       Console.WriteLine()       For Each pair As KeyValuePair(Of String, String) In education          Console.WriteLine(pair.Value)       Next    End Sub End Class Bachelor of Science Bachelor of Arts Bachelor of Science Master of Arts Master of Science Master of Philosophy Doctor of Philosophy