Glad that you found a solution!
By the way, it would probably be best to minimize your use of the dynamic machinery. Declaring a variable as
Another option might be to expose only
Good luck!
V8ScriptItem
is just a concrete implementation of DynamicObject
. It doesn't have any additional members that would be useful to the host. The idea is that you either use its DynamicObject
members, or you use it via the dynamic
keyword.By the way, it would probably be best to minimize your use of the dynamic machinery. Declaring a variable as
dynamic
causes the compiler to emit a dynamic callsite everywhere that variable is used, and that could get very expensive, especially when combined with the overhead of invoking V8. Consider rewriting your class something like this:publicclass Konsoll { privatevoid logg(int indent, DynamicObject od) { foreach (string egenskap in od.GetDynamicMemberNames()) { Console.Write(new String(' ', indent) + egenskap + ':'); object m = ((dynamic)od)[egenskap]; // this is the only dynamic callsitevar md = m as DynamicObject; if (md != null) { Console.WriteLine(); logg(indent + 1, md); } else { Console.WriteLine(m); } } } publicvoid log(DynamicObject od) { logg(0, od); } }
System.Console
and implement console
entirely in script code.Good luck!