ToBoolean() private method

private ToBoolean ( Object value ) : bool
value Object
return bool
示例#1
0
            public override bool Eval(object context)
            {
                //
                // Following is equivalent to calling apply in JScript.
                // See http://msdn.microsoft.com/en-us/library/84ht5z59.aspx.
                //

                object result = LateBinding.CallValue(
                    DefaultThisObject(Engine),
                    _function, /* args */ new object[] { context, context },
                    /* construct */ false, /* brackets */ false, Engine);

                return(Convert.ToBoolean(result));
            }
            public override bool Eval(object context)
            {
                VsaEngine engine = Engine;

                //
                // Following is equivalent to calling eval in JScript,
                // with the value of the context variable established at the
                // global scope in order for it to be available to the
                // expression source.
                //

                _contextField.SetValue(_scope, context);

                try
                {
                    With.JScriptWith(context, engine);
                    return(Convert.ToBoolean(Microsoft.JScript.Eval.JScriptEvaluate(_expression, engine)));
                }
                finally
                {
                    engine.PopScriptObject(/* with */);
                }
            }