开发者

What's the easiest way to get Dictionary functionality in VB.NET?

I want to statically defin开发者_运维问答e a mapped array of strings like:

var dict = {cat:50, bat:10, rat:30};

and lookup values within it like:

MessageBox.Show( dict["cat"] )


Dim dict As New Dictionary(Of String, Integer)()

With dict 
    .Add("Cat", 50)
    .Add("Bat", 10)
    .Add("Rat", 30)
End With


In .NET 4.0:

Dim d As Dictionary(Of String, Integer) From
    {{"cat", 50}, {"bat", 10}, {"rat",30 }} 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜