Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

New Post: Parent-child script relation

0
0
Hi ifle,

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();
} 
However, again, it isn't recommended. 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?

Viewing all articles
Browse latest Browse all 2297

Latest Images

Trending Articles





Latest Images