public void Visit(BinaryExpression expression)
        {
            if (expression == null)
            {
                throw new ArgumentNullException("expression");
            }

            expression.LeftExpression.Accept(this);
            object left = result;

            expression.RightExpression.Accept(this);
            object right = result;

            if (left is int && right is int)
            {
                switch (expression.Type)
                {
                    case BinaryExpressionType.Plus:
                        result = Convert.ToInt32(left, CultureInfo.InvariantCulture) + Convert.ToInt32(right, CultureInfo.InvariantCulture);
                        break;
                    case BinaryExpressionType.Minus:
                        result = Convert.ToInt32(left, CultureInfo.InvariantCulture) - Convert.ToInt32(right, CultureInfo.InvariantCulture);
                        break;
                    case BinaryExpressionType.Multiply:
                        result = Convert.ToInt32(left, CultureInfo.InvariantCulture) * Convert.ToInt32(right, CultureInfo.InvariantCulture);
                        break;
                    case BinaryExpressionType.Div:
                        result = Convert.ToInt32(left, CultureInfo.InvariantCulture) / Convert.ToInt32(right, CultureInfo.InvariantCulture);
                        break;
                    case BinaryExpressionType.Mod:
                        result = Convert.ToInt32(left, CultureInfo.InvariantCulture) % Convert.ToInt32(right, CultureInfo.InvariantCulture);
                        break;
                    case BinaryExpressionType.ShiftLeft:
                        result = Convert.ToInt32(left, CultureInfo.InvariantCulture) << Convert.ToInt32(right, CultureInfo.InvariantCulture);
                        break;
                    case BinaryExpressionType.ShiftRight:
                        result = Convert.ToInt32(left, CultureInfo.InvariantCulture) >> Convert.ToInt32(right, CultureInfo.InvariantCulture);
                        break;
                    case BinaryExpressionType.GreaterOrEqual:
                        result = (Convert.ToInt32(left, CultureInfo.InvariantCulture) >= Convert.ToInt32(right, CultureInfo.InvariantCulture)) ? 1 : 0;
                        break;
                    case BinaryExpressionType.LesserOrEqual:
                        result = (Convert.ToInt32(left, CultureInfo.InvariantCulture) <= Convert.ToInt32(right, CultureInfo.InvariantCulture)) ? 1 : 0;
                        break;
                    case BinaryExpressionType.Greater:
                        result = (Convert.ToInt32(left, CultureInfo.InvariantCulture) > Convert.ToInt32(right, CultureInfo.InvariantCulture)) ? 1 : 0;
                        break;
                    case BinaryExpressionType.Lesser:
                        result = (Convert.ToInt32(left, CultureInfo.InvariantCulture) < Convert.ToInt32(right, CultureInfo.InvariantCulture)) ? 1 : 0;
                        break;
                    case BinaryExpressionType.Equal:
                        result = (Convert.ToInt32(left, CultureInfo.InvariantCulture) == Convert.ToInt32(right, CultureInfo.InvariantCulture)) ? 1 : 0;
                        break;
                    case BinaryExpressionType.NotEqual:
                        result = (Convert.ToInt32(left, CultureInfo.InvariantCulture) != Convert.ToInt32(right, CultureInfo.InvariantCulture)) ? 1 : 0;
                        break;
                    case BinaryExpressionType.BitXor:
                        result = Convert.ToInt32(left, CultureInfo.InvariantCulture) ^ Convert.ToInt32(right, CultureInfo.InvariantCulture);
                        break;
                    case BinaryExpressionType.BitAnd:
                        result = Convert.ToInt32(left, CultureInfo.InvariantCulture) & Convert.ToInt32(right, CultureInfo.InvariantCulture);
                        break;
                    case BinaryExpressionType.BitOr:
                        result = Convert.ToInt32(left, CultureInfo.InvariantCulture) | Convert.ToInt32(right, CultureInfo.InvariantCulture);
                        break;
                    case BinaryExpressionType.And:
                        bool andResult = Convert.ToBoolean(left, CultureInfo.InvariantCulture) && Convert.ToBoolean(right, CultureInfo.InvariantCulture);
                        result = Convert.ToInt32(andResult);
                        break;
                    case BinaryExpressionType.Or:
                        bool orResult = Convert.ToBoolean(left, CultureInfo.InvariantCulture) || Convert.ToBoolean(right, CultureInfo.InvariantCulture);
                        result = Convert.ToInt32(orResult);
                        break;
                    default:
                        throw new ExpressionEvaluatorException(
                            string.Format(CultureInfo.InvariantCulture, "binary operation '{0}' is not supported.", expression.Type));
                }
            }
            else
            {
                result = string.Format(CultureInfo.InvariantCulture, "{0} {1} {2}",
                    left,
                    GetBinaryOperatorString(expression.Type),
                    right);
            }
        }
 public void Visit(BinaryExpression expression)
 {
     throw new NotImplementedException();
 }