我有一个用条目设置的字典。我想得到与该值相对应的字母,我有点卡在它的编码方面。到目前为止,这是我的代码:
Dim chardict As New Dictionary(Of Char, Integer)
chardict.Add("A", 0)
chardict.Add("B", 1)
If chardict.ContainsValue(1) then
Console.WriteLine(the letter that corrosponds to the value)
end if
Output: B
提前致谢
答案 0 :(得分:2)
将此添加到您的IF语句中:
Dim Value = (From t In chardict
Where t.Value = 1
Select t.Key
)
Console.WriteLine(Value(0))