private object GetSingleValue(IOperationExpressionContext context, string operand) { if (context.IsString(operand)) { return(operand.Substring(1, operand.Length - 2)); } bool bvalue = false; if (bool.TryParse(operand, out bvalue)) { return(bvalue); } long ivalue = 0L; if (long.TryParse(operand, out ivalue)) { return(ivalue); } decimal fvalue = 0M; if (decimal.TryParse(operand, out fvalue)) { return(fvalue); } return(operand); }
protected virtual bool ComputeResult(IOperationExpressionContext context, IEnumerable <object> operands) { object operand1 = operands.ElementAt(0); object operand2 = operands.ElementAt(1); if (object.ReferenceEquals(operand1, operand2)) { return(true); } if (operand1 == operand2) { return(true); } if (context.IsString(operand1) ^ context.IsString(operand2)) { return(false); } return(string.Equals(operand1.ToString(), operand2.ToString(), StringComparison.OrdinalIgnoreCase)); }