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

RunScript() public static method

Runs a serialized script.
Requires an active script context.
public static RunScript ( string script, byte buffer, JavaScriptSourceContext sourceContext, string sourceName ) : JavaScriptValue
script string The source code of the serialized script.
buffer byte The serialized script.
sourceContext JavaScriptSourceContext /// A cookie identifying the script that can be used by script contexts that have debugging enabled. ///
sourceName string The location the script came from.
return JavaScriptValue
        public static JavaScriptValue RunScript(string script, byte[] buffer, JavaScriptSourceContext sourceContext, string sourceName)
        {
            JavaScriptValue result;
            Native.ThrowIfError(Native.JsRunSerializedScript(script, buffer, sourceContext, sourceName, out result));
            return result;
        }

Same methods

JavaScriptContext::RunScript ( string script ) : JavaScriptValue
JavaScriptContext::RunScript ( string script, JavaScriptSourceContext sourceContext, string sourceName ) : JavaScriptValue
JavaScriptContext::RunScript ( string script, byte buffer ) : JavaScriptValue

Usage Example

        public object Evaluate(string expression)
        {
            object result = InvokeScript(() =>
            {
                JavaScriptValue resultValue = JavaScriptContext.RunScript(expression);

                return(MapToHostType(resultValue));
            });

            return(result);
        }
All Usage Examples Of MsieJavaScriptEngine.JsRt.JavaScriptContext::RunScript