예제 #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);
        }
예제 #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");
        }