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

New Post: C# Constructor

$
0
0
Hello.

I have two class definitions in c# like this:
publicclass Foo
{
    public Foobar(int x)
    {
    ...
    }
}
publicclass Bar : Foo
{
    public Bar(int x) : base(x)
    {
    ...
    }
}
Now I would like to make the constructors available to the JavaScript Engine. However, not as global functions but as functions of some object. Something like this:
var engine = new V8ScriptEngine( name, flags, debugPort );
engine.Script.SomeObject.Foo = engine.CompileConstructor(typeof(Foo));
engine.Script.SomeObject.Bar = engine.CompileConstructor(typeof(Bar));
Is there a way to accomplish this? Any chance that this would even work with JavaScript's instanceof operator?

Viewing all articles
Browse latest Browse all 2297

Trending Articles



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