NVelocity.Runtime.Parser.Node.ASTNENode.Evaluate C# (CSharp) Method

Evaluate() public method

public Evaluate ( IInternalContextAdapter context ) : bool
context IInternalContextAdapter
return bool
        public override bool Evaluate(IInternalContextAdapter context)
        {
            Object left = GetChild(0).Value(context);
            Object right = GetChild(1).Value(context);

            try
            {
                return ObjectComparer.CompareObjects(left, right) != 0;
            }
            catch
            {
                // Ignore, we can't compare decently by value, but we honestly don't give a sh*t
            }

            // If we can't actually compare the objects, try the operator as fallback
            // For operator overloaded types, this will not really be a reference comp, but that's ok.
            return left != right;
        }