我有这个函数返回一个哈希表
Public Shared Function getMsg(msgCode As String) As Hashtable
Dim msgtable As Hashtable = New Hashtable
'more and more codes were here...
Return msgtable
End Function
我试图用函数调用
做这样的事情 'where the function resides on a class named **common**
common.getMsg("1").Item("ss")
但是我的visual studio IDE不允许我执行上面的代码。
在其他语言如PHP,Javascript和其他语言中接受这种方法,但为什么VB.NET不接受?如果它不接受这样的方法那么他们的任何解决方法是什么?感谢
答案 0 :(得分:0)
以这种方式使用VB.NET Hashtable ...添加到哈希表
Dim table As Hashtable = New Hashtable
table.Add("key", value)
要检索值:
table("key")
将有效
你会传递common.getMsg(" 1")
它将返回键#34; 1"
下的值