Expose C# array as JSArray

Nov 26, 2013 at 3:14 AM
How do I enable something like this to work?
            var engine = new JintEngine();
            var array = new[] {"a", "b", "c"};

            engine.SetParameter("data", array);

            var result = engine.Run("return data.length;");
I want my C# object to be converted to an JS object. If push is called then I don't want that to affect my object, so it's like a clone into JS.
Can this be done?
Dec 31, 2013 at 6:47 PM
I would do it this way
        var array      = new [] {"a", "b", "c"};
        var defineData = string.Format("data = {0};",Newtonsoft.Json.JsonConvert.SerializeObject(array));
        var jint       = GetJint();