好吧,我不确定我问的问题是否正确,但这里是。我正在使用Javascript .NET来解析 Javascript 对象数组。我的代码看起来像这样:
object packlist;
using (var context = new JavascriptContext())
{
context.Run(@"function packlist() { this.packs = new Array(); }
var packlist = new packlist();
packlist.packs[0] = { item1:""something"", item2:""something2"", item3:""something3"" };
packlist.packs[1] = { item1:""something"", item2:""something2"", item3:""something3"" };
packlist.packs[2] = { item1:""something"", item2:""something2"", item3:""something3"" };");
packlist = context.GetParameter("packlist");
}
调试时,Locals 窗口显示对象看起来像这样
我的问题是我将如何访问item1
from packlist.packs[0]
?