Skip to content

Instantly share code, notes, and snippets.

@warriorg
Forked from anonymous/donet invoke js
Created November 8, 2013 02:40
Show Gist options
  • Save warriorg/7365437 to your computer and use it in GitHub Desktop.
Save warriorg/7365437 to your computer and use it in GitHub Desktop.
var jsContext = new IronJS.Hosting.CSharp.Context();
jsContext.ExecuteFile("myDlr.js");
var fun = jsContext.GetFunctionAs<Func<double, double, double>>("cacl");
double a = Double.Parse(this.tbxA.Text);
double b = Double.Parse(this.tbxB.Text);
var result = fun.Invoke(a,b);
this.tbxResult.Text = result.ToString();
var cacl = function (a, b) {
return a*b;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment