1
我想从IronRuby脚本调用一个C#方法来产生Ruby散列。我试过字典,但保持原样。.Net对象对应于IronRuby散列
public Dictionary<string, string> GetHash()
{
Dictionary<string, string> hash = new Dictionary<string, string>();
hash.Add("a", "1");
hash.Add("b", "2");
return hash;
}
我希望能够用它在我的IronRuby脚本作为哈希
myHash = scopeObj.GetHash()
myHash.each{ |k,v|
print("#{k}=#{v}")
}
其结果是:
[a, 1]=
[b, 2]=