static void Main (string[] args) { var eng = new Jurassic.scriptengine (); Eng. Evaluate ("function text () {return ten;}"); int rs= Eng. Callglobalfunction<int> ("text"); Console.WriteLine (RS); Console.read (); }
Plugin https://jurassic.codeplex.com/releases/view/115831
How to Receive JS object?
Class program { static void Main (string[] args) { var eng = new Jurassic.scriptengine (); Eng. Evaluate ("function text () {return json.stringify ({' A ': ten, ' B ': ');}"); var rs = eng. Callglobalfunction<string> ("text"); var model = util.serializerjsonorentity.getobject<model> (RS); Console.WriteLine (MODEL.A); Console.read (); } } public class Model {public int a {get; set;} public int b {get; set;} }
The scheme mainly through the serialization of receiving can write their own extension function to serialize the JS returned object after serialization in C # as long as the data structure is consistent
Util.SerializerJsonOrEntity.GetObject the function for its own encapsulated serialization function based on the serialization class library of. Net
Using Jurassic to run JS functions under. Net