MsieJavaScriptEngine.JsRt.JavaScriptContext.SerializeScript C# (CSharp) Method

SerializeScript() public static method

Serializes a parsed script to a buffer than can be reused.

SerializeScript parses a script and then stores the parsed form of the script in a runtime-independent format. The serialized script then can be deserialized in any runtime without requiring the script to be re-parsed.

Requires an active script context.

public static SerializeScript ( string script, byte buffer ) : ulong
script string The script to serialize.
buffer byte The buffer to put the serialized script into. Can be null.
return ulong
        public static ulong SerializeScript(string script, byte[] buffer)
        {
            var bufferSize = (ulong)buffer.Length;
            Native.ThrowIfError(Native.JsSerializeScript(script, buffer, ref bufferSize));
            return bufferSize;
        }