public static string JsValue2String(JsValueRef Result)
        {
            JsValueRef ResultString;
            JsValueRef ResultStringPtr;

            if (JsErrorCode.JsNoError != JsConvertValueToString(Result, out ResultString))
            {
                return(null);
            }
            IntPtr bytesCount = IntPtr.Zero;

            if (JsErrorCode.JsNoError != JsStringToPointer(ResultString, out ResultStringPtr, out bytesCount))
            {
                return(null);
            }
            return(Marshal.PtrToStringUni(ResultStringPtr.Value));
        }
 public static extern JsErrorCode JsGetAndClearException(out JsValueRef exception);
 public static extern JsErrorCode JsStringToPointer(JsValueRef value, out JsValueRef stringValue, out IntPtr stringLength);
 public static extern JsErrorCode JsCopyString(JsValueRef value, out byte[] stringValue, IntPtr bufferSize, out IntPtr bytesCount);
 public static extern JsErrorCode JsConvertValueToString(JsValueRef value, out JsValueRef stringValue);
 public static extern JsErrorCode JsRunScript(string script, JsSourceContext sourceContext, string sourceUrl, out JsValueRef result);