Creating a constant Dictionary in C#
Code:Dictionary<string, int> ids = new Dictionary<string, int> {
{"abc",1}, {"def",2}, {"ghi",3}
};
How to write the same in VB?
Printable View
Creating a constant Dictionary in C#
Code:Dictionary<string, int> ids = new Dictionary<string, int> {
{"abc",1}, {"def",2}, {"ghi",3}
};
How to write the same in VB?
vb Code:
Dim ids As New Dictionary(Of String, Integer) ids.Add("abc", 1) ids.Add("def", 2) ids.Add("ghi", 3)
It's too obvious to be what I need in :) Sorry...
In VB10 (VS 2010), you can have:
Code:Dim ids As New Dictionary(Of String, Integer)() From {{"abc",1}, {"def",2}, {"ghi",3}}