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

New Post: Add functions and property from an Interface to a new API of the engine

$
0
0
Hi Sybaris,

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')");
Note that using 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!

Viewing all articles
Browse latest Browse all 2297

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>