Hi,
I'm using a library (CSG.js) and I need to call it from .Net. I instantiate a few objects and do operation on them. The information on what object and how I combine them comes from .Net. I'm having problem figuring how to do this.
I'm getting this error: 'Microsoft.ClearScript.Undefined' does not contain a definition for 'DoStuff'
Here's a simplified sample of what I'm doing.
I'm using a library (CSG.js) and I need to call it from .Net. I instantiate a few objects and do operation on them. The information on what object and how I combine them comes from .Net. I'm having problem figuring how to do this.
I'm getting this error: 'Microsoft.ClearScript.Undefined' does not contain a definition for 'DoStuff'
Here's a simplified sample of what I'm doing.
V8ScriptEngine engine;
engine = new V8ScriptEngine(V8ScriptEngineFlags.EnableDebugging);
engine.Execute(@"MyClass = function() {
this.First = [];
this.Second = 2;
};
MyClass.prototype = {
DoStuff: function(someInt) {
var mc = new MyClass();
mc.Second = this.Second + mc.Second;
}
};
");
dynamic v1 = engine.Evaluate("new MyClass();");
dynamic v2 = engine.Evaluate("new MyClass();");
dynamic res = engine.Script.v1.DoStuff(2);
Console.WriteLine((int)res);
Thanks