How do can I convert to a dictionary of name & value pairs from a JS object passed into a host C# method ? My problem is how to interpret the 'object's that are received at the exec function. If they were int's I could just use...
foreach (int i in args)...
...but they are...what ?
For example, in a JS file I have
myApi.exec("doThang", { dog: "Rover", cat: "Purdy", mouse: "Mini", <non-specific list of more...> } );
In C# I have
public void foo()
{
var engine = new V8ScriptEngine();
engine.AddHostObject("myApi", a); // see below
// load the above JS
string script = loadScript();
// execute that script
engine.Execute(script);
}
public class a
{
public void exec(string name, params object[] args){
// - how to iterate the args and create say a dictionary of key value pairs?
}
}
EDIT: Changed the specifics of the question now that I understand the 'params' keyword is not specifically part of ClearScript.