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

New Post: C# Constructor

0
0
Hi ZoneRunner,

There are several ways to do this. One is to use ClearScript's ExtendedHostFunctions class:
var xHost = new ExtendedHostFunctions();
engine.Script.SomeObject.Foo = xHost.type(typeof(Foo));
engine.Script.SomeObject.Bar = xHost.type(typeof(Bar));
engine.Execute("bar = new SomeObject.Bar(123)");
You can't use instanceof to examine a host object's type information. If that's a requirement, consider defining native JavaScript types that wrap your host types as necessary.

Good luck!

Viewing all articles
Browse latest Browse all 2297