2
有什麼辦法可以在VB.NET中做同樣的事情嗎?如何在VB.NET中直接填寫字典(TKey,TValue)
Dictionary<int, string> myDict = new Dictionary<int, string>()
{
{ 2, "This" },
{ 1, "is" },
{ 5, "radio" },
{ 12, "clash" },
};
同樣的問題http://stackoverflow.com/questions/318530/is-it-possible-to-initialise-a-new-system -collections-generic-dictionary-with-str 檢查jgauffin的回答。下面是一個例子: 'Dim myDic As New Dictionary(Of Integer,String)From {{1,「One」},{2,「Two」}}'。這僅適用於VB.NET 10 – 2010-07-21 14:01:26