Hi Sybaris,
You can use the "global members" feature to achieve the desired effect:
Note that using
Thanks for your question!
You can use the "global members" feature to achieve the desired effect:
ITest t = new Test(); engine.AddRestrictedHostObject("test", HostItemFlags.GlobalMembers, t); engine.Execute("foo('hello')");
AddRestrictedHostObject()
in this manner ensures that only the ITest
interface members are exposed for scripting. Other members of the object remain inaccessible. Use AddHostObject()
if that is not the desired behavior.Thanks for your question!