Created
November 8, 2013 02:38
-
-
Save anonymous/7365426 to your computer and use it in GitHub Desktop.
C#调用JS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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