我正在从Javascript向C#发送帖子请求
的Javascript
var name = "doe";
var ids = [1,2,3];
var parameter = {
ids : ids,
name : name,
groups: groups
}
C#
public string sampleMethod (Hashtable hashtable)
{
string name = hashtable["name"].toString();//works well
List<long> ids = (List<long>)hashtable["ids"];//doesnt work
}
我只想从哈希表中获取值[1,2,3] [&#34; ids&#34;]然后将其转换为long;
答案 0 :(得分:0)
试试这个..
Array ids = (Array)hashtable["ids"];
或
List<int> ids = (List<int>)hashtable["ids"];
或
int[] ids = (int[])hashtable["ids"];