Public Sub Add(ByVal phone As String, ByVal name As String)
MyBase.InnerHashtable.Add(phone, name)
End Sub
'--Subroutine to extract the value from a dictionary when the key is passed as input
Public Function Item(ByVal phone As String) As String
Return CStr(MyBase.InnerHashtable.Item(phone))
End Function
示例项:。的关键查字典(VB.NET
'--Adding key and values to the dictionary
myDict.Add("6812036998", "Horton")
myDict.Add("6812036999", "Olive")
我需要帮助,在字典中的反向查找鉴于key
我应该能够找到名称然而,我下面不会工作代码,这是错误的
Public Function lookupValue(ByVal name As String)
Return CStr(MyBase.InnerHashtable.Item(name))
End Function
为什么你想找到'name' 结束在'Dictionary'中,当已经给出'name'时。或者我想你想在'key'的时候找到'name'? – jamiedanq