Torben
Torben

Reputation: 1290

How to fill Dictionary(Of TKey, TValue) directly in VB.NET

is there any way to do the same in VB.NET?

Dictionary<int, string> myDict = new Dictionary<int, string>()     
{        
     { 2, "This" },    
     { 1, "is" },          
     { 5, "radio" },      
     { 12, "clash" },     
};

Upvotes: 2

Views: 2291

Answers (1)

knslyr
knslyr

Reputation: 640

As stated in Marcel's comment above:

Dim myDict As New Dictionary(Of Integer, String) From _
        {{1, "one"}, {2, "two"}, {3, "three"}}

Upvotes: 9

Related Questions