当前位置: 首页>>代码示例>>C#>>正文


C# IExpression.ToString方法代码示例

本文整理汇总了C#中IExpression.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# IExpression.ToString方法的具体用法?C# IExpression.ToString怎么用?C# IExpression.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IExpression的用法示例。


在下文中一共展示了IExpression.ToString方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: IsEqual

        public static bool IsEqual(IExpression ex, IExpression ex2, AbstractSymbolValueProvider vp)
        {
            var val_x1 = Evaluation.EvaluateValue(ex, vp);
            var val_x2 = Evaluation.EvaluateValue(ex2, vp);

            //TEMPORARILY: Remove the string comparison
            if (val_x1 == null && val_x2 == null)
                return ex.ToString() == ex2.ToString();

            return IsEqual(val_x1, val_x2);
        }
开发者ID:DinrusGroup,项目名称:DRC,代码行数:11,代码来源:SymbolValueComparer.cs

示例2: CheckExp

        private static bool CheckExp(IExpression o, IExpression n)
        {
            if (o == null && n == null)
                return true;
            try
            {
                return (o.ToString() == n.ToString());

            }
            catch (NullReferenceException)
            {
                return false;
            }
        }
开发者ID:ScottWeinstein,项目名称:ILUnMerge,代码行数:14,代码来源:AssemComp.cs

示例3: ToString

 public static string ToString(IExpression expr)
 {
     return expr == null ? string.Empty : expr.ToString();
 }
开发者ID:Oman,项目名称:Maleos,代码行数:4,代码来源:SqlQueryUtils.cs

示例4: GetExpressionDispatch

            //public string GetCollectionPredicateExpression(RequestContext requestContext, ref List<OleDbParameter> parameters)
            //{
            //    string resourceKey = requestContext.ResourceKey;
            //    if (null == resourceKey)
            //        throw new InvalidOperationException();
            //    string scrmIdentifierName = _entityQueryWrapper.GetSageCrmIdentifier();
            //    string dbIdentifierName = _entityQueryWrapper.GetDbFieldName(scrmIdentifierName);
            //    parameters.Add(_entityQueryWrapper.GetOleDbParameter(dbf
            //    Type dbType = _entityQueryWrapper.GetDbFieldType(dbIdentifierName);
            //    if (dbType == typeof(string))
            //        return " ([" + dbIdentifierName + "] = '" + requestContext.ResourceKey + "') ";
            //    else
            //        return " ([" + dbIdentifierName + "] = " + requestContext.ResourceKey + ") ";
            //}
            public string GetExpressionDispatch(IExpression expression, ref List<OleDbParameter> parameters)
            {
                if (expression is ShortcutConditionalOperatorExpression)
                {
                    return GetExpression(expression as ShortcutConditionalOperatorExpression, ref parameters);
                }

                if (expression is ComparisonOperatorExpression)
                {
                    return GetExpression(expression as ComparisonOperatorExpression, ref parameters);
                }

                if (expression is LikeExpression)
                {
                    return GetExpression(expression as LikeExpression, ref parameters);
                }
                if (expression is DivideExpression)
                {
                    return GetExpression(expression as DivideExpression, ref parameters);
                }
                if (expression is MultiplyExpression)
                {
                    return GetExpression(expression as MultiplyExpression, ref parameters);
                }
                if (expression is MinusExpression)
                {
                    return GetExpression(expression as MinusExpression, ref parameters);
                }
                if (expression is PlusExpression)
                {
                    return GetExpression(expression as PlusExpression, ref parameters);
                }
                if (expression is LiteralExpression) // 'alfki' 1 ....
                {
                    return GetExpression(expression as LiteralExpression, ref parameters);
                }
                if (expression is FieldExpression) // customerid ....
                {
                    return GetExpression(expression as FieldExpression, ref parameters);
                }
                if (expression is BetweenExpression) // between
                {
                    return GetExpression(expression as BetweenExpression, ref parameters);
                }
                if (expression is UnaryOperatorExpression)  //Not
                {
                    return GetExpression(expression as UnaryOperatorExpression, ref parameters);
                }
                else
                    return expression.ToString();
            }
开发者ID:Sage,项目名称:SData-Contracts,代码行数:65,代码来源:QueryFilterBuilder.cs

示例5: Unify

        /// <summary>
        /// Unify the given Expressions
        /// </summary>
        /// <param name="ex1">first expression</param>
        /// <param name="ex2">second expression</param>
        /// <returns>most general unifier</returns>
        public static IExpression Unify(IExpression ex1, IExpression ex2)
        {
            if (ex1.IsVariable)
            {
                if (ex2.IsVariable)
                {
                    if (ex1.Value == ex2.Value) return ex1;

                    throw new NotUnifiableException(ex1.Value, ex2.Value, "both are variables");
                }
                if (ex2.IsFunction)
                {
                    VariableRegistry.Instance[(VariableExpression)ex1] = ex2;
                    return ex2;
                }
                VariableRegistry.Instance[(VariableExpression)ex1] = ex2;
                return ex2;
            }
            if (ex1.IsFunction)
            {
                if (ex2.IsVariable)
                {
                    VariableRegistry.Instance[(VariableExpression)ex2] = ex1;
                    return ex2;
                }
                if (ex2.IsFunction)
                {
                    if (ex1.Value != ex2.Value) throw new NotUnifiableException(ex1.Value, ex2.Value, "argument missmatch");

                    var exp1 = (FunctionExpression) ex1;
                    var exp2 = (FunctionExpression) ex2;

                    if (exp1.Expressions.Length != exp2.Expressions.Length)
                        throw new NotUnifiableException(ex1.ToString(), ex2.ToString(), "argument length missmatch");

                    var exp = new IExpression[exp1.Expressions.Length];

                    for (int i = 0; i < exp1.Expressions.Length; i++)
                    {
                        exp[i] = Unify(exp1.Expressions[i], exp2.Expressions[i]);
                    }
                    return new FunctionExpression(exp1.Value, exp);
                }
                throw new NotUnifiableException(ex1.Value, ex2.Value, "no variable preseent");
            }
            if (ex2.IsVariable)
            {
                VariableRegistry.Instance[(VariableExpression)ex2] = ex1;
                return ex1;
            }
            if (ex2.IsFunction)
            {
                throw new NotUnifiableException(ex1.Value, ex2.Value, "no variable preseent");
            }
            if (ex1.Value == ex2.Value)
                return ex1;
            throw new NotUnifiableException(ex1.Value, ex2.Value, "no variable preseent");
        }
开发者ID:h3ll5ur7er,项目名称:Unification,代码行数:64,代码来源:Parser.cs

示例6: TryConvertToInteger

        public bool TryConvertToInteger(IExpression value, out int result)
        {
            if (value == null) {
                result = 0;
                return true;
            }
            var asValue = value as IValueExpression;
            if (asValue != null) {
                int intVal;
                if (TryConvert(asValue.Value, out intVal)) {
                    result = intVal;
                    return true;
                }
            }

            var str = value.ToString().Trim();

            bool b;
            if (bool.TryParse(str, out b)) {
                result = b ? 1 : 0;
                return true;
            }

            if (int.TryParse(str, out result))
                return true;

            result = 0;
            return false;
        }
开发者ID:KevinAllenWiegand,项目名称:SaintCoinach,代码行数:29,代码来源:DefaultEvaluationFunctionProvider.cs

示例7: ToBoolean

        public bool ToBoolean(IExpression value)
        {
            if (value == null)
                return false;
            var asValue = value as IValueExpression;
            if (asValue != null) {
                bool boolVal;
                if (TryConvert(asValue.Value, out boolVal))
                    return boolVal;
            }

            var str = value.ToString().Trim();

            bool b;
            if (bool.TryParse(str, out b))
                return b;

            int i;
            if (int.TryParse(str, out i))
                return i != 0;

            return str.Length > 0;
        }
开发者ID:KevinAllenWiegand,项目名称:SaintCoinach,代码行数:23,代码来源:DefaultEvaluationFunctionProvider.cs

示例8: Push

 public void Push(IExpression expr)
 {
     Text = expr.ToString();
 }
开发者ID:mcwatt77,项目名称:vimcontrols,代码行数:4,代码来源:IVIMExpressionProcessor.cs


注:本文中的IExpression.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。