Example #1
0
        public static object valueOf(object thisObj)
        {
            if (!Convert.IsBoolean(thisObj))
            {
                throw new JScriptException(JSError.BooleanExpected);
            }

            if (thisObj is bool)
            {
                return(thisObj);
            }

            BooleanObject bo = thisObj as BooleanObject;

            return(bo.value);
        }
Example #2
0
        public static string toString(object thisObj)
        {
            if (!Convert.IsBoolean(thisObj))
            {
                throw new JScriptException(JSError.BooleanExpected);
            }

            if (thisObj is bool)
            {
                return((bool)thisObj ? "true" : "false");
            }

            BooleanObject bo = thisObj as BooleanObject;

            return(bo.value ? "true" : "false");
        }