在字典中的值我有這個dictoinary:如何找到在VB
Dim chardict As Dictionary(Of Char, Integer) = Nothing
chardict.Add("A", 0)
chardict.Add("B", 1)
我想如果語句,但我被困在語法有點做到以下幾點:
if chardict.containskey("A")
'display the value that corrosponds to the letter "A"
'in this case display the character 0
[some code]
end if
謝謝推進
假設你實際上在某個地方創建了chardict並且禁用了option-strict以允許嚴格g-> char(將字符串不是更好的選擇?),應該工作,您需要擴展您的示例 – 2012-02-22 10:43:11