In C #, specify the class using the method you want to run.
public class JavaScriptHelper {
public string Method(string input) {
return String.Concat("Hi", input);
}
}
Then pass the class to the engine.
var engine = new Engine();
engine.SetValue("helper", new JavaScriptHelper());
var source = @" var result = helper.Method('Hello');"
engine.Run(source);
source
share