Greetings!
There a several ways to go here. Suppose you have a JavaScript function that takes such an object:
You can use a dynamic .NET object for the argument:
Another possibility is to use ClearScript's
A third option is simply to use a script object:
Keep in mind though that if the argument is a large dictionary with hundreds of elements, then JSON tunneling, as clunky as it is, could provide better performance, as it minimizes the number of dynamic calls and objects flowing across the host-script boundary.
Good luck!
There a several ways to go here. Suppose you have a JavaScript function that takes such an object:
engine.AddHostType(typeof(Console)); engine.Execute(@" function foo(arg) { Console.WriteLine(arg['a.b']); Console.WriteLine(arg['foo.bar']); } ");
IDictionary<string, object> arg = new ExpandoObject(); arg["a.b"] = 123; arg["foo.bar"] = 456; engine.Script.foo(arg);
PropertyBag
class:var arg = new PropertyBag(); arg["a.b"] = 123; arg["foo.bar"] = 456; engine.Script.foo(arg);
dynamic arg = engine.Evaluate("({})"); arg["a.b"] = 123; arg["foo.bar"] = 456; engine.Script.foo(arg);
Good luck!