Hi ifle,
This seems to work:
However, again, it isn't recommended.
Instead of exposing script items across engines, would it not be possible to load everything you need into the child engine?
This seems to work:
using (var globalScript = new VBScriptEngine()) using (var childScript = new VBScriptEngine()) { Console.WriteLine("Start VBScriptEngine"); globalScript.Script.numValue = 4; childScript.AddHostObject("GlobalScript", HostItemFlags.GlobalMembers, globalScript.Script); Console.WriteLine(childScript.Evaluate("5 * numValue")); Console.WriteLine("End script"); Console.ReadKey(); }
AddHostObject()
is intended to be used with, well, host objects :)Instead of exposing script items across engines, would it not be possible to load everything you need into the child engine?