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


C# ExpressionType.ToString方法代码示例

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


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

示例1: GetRight

 Expression GetRight(ExpressionType expressionType, Expression right, Type type, ParameterExpression parameterExpression) {
     if (expressionType == ExpressionType.AndAlso || expressionType == ExpressionType.OrElse)
         return Convert(type, right, parameterExpression);
     if (expressionType == ExpressionType.Equal || expressionType == ExpressionType.NotEqual)
         return right;
     throw new NotImplementedException(expressionType.ToString());
 }
开发者ID:aries544,项目名称:eXpand,代码行数:7,代码来源:ExpressionConverter.cs

示例2: GetBinaryOperation

 public static string GetBinaryOperation(ExpressionType expressionType)
 {
     if (BinaryLookup.ContainsKey(expressionType))
     {
         return BinaryLookup[expressionType];
     }
     return expressionType.ToString();
 }
开发者ID:g0t4,项目名称:ExpectEx,代码行数:8,代码来源:ExpressionTypeLookup.cs

示例3: ExpressionTypeToHumanString

 private static string ExpressionTypeToHumanString(ExpressionType type)
 {
     switch (type)
     {
         case ExpressionType.DaysOfMonth:
             return "days of the month";
         case ExpressionType.DaysOfWeek:
             return "days of the week";
         case ExpressionType.IntervalValue:
             return "interval";
         default:
             return type.ToString().ToLowerInvariant();
     }
 }
开发者ID:modulexcite,项目名称:cs-schyntax,代码行数:14,代码来源:Validator.cs

示例4: Friendly

 private static string Friendly(ExpressionType nodeType)
 {
     switch (nodeType)
     {
         case ExpressionType.And:
         case ExpressionType.AndAlso:
             return "AND";
         case ExpressionType.Not:
             return "NOT";
         case ExpressionType.Or:
         case ExpressionType.OrElse:
             return "OR";
         case ExpressionType.Add:
             return "+";
         case ExpressionType.Subtract:
             return "-";
         case ExpressionType.Multiply:
             return "*";
         case ExpressionType.Divide:
             return "/";
         case ExpressionType.Equal:
             return "==";
         case ExpressionType.LessThan:
             return "<";
         case ExpressionType.LessThanOrEqual:
             return "<=";
         case ExpressionType.Modulo:
             return "%";
         case ExpressionType.Negate:
             return "-";
         case ExpressionType.GreaterThan:
             return ">";
         case ExpressionType.GreaterThanOrEqual:
             return ">=";
         default:
             return nodeType.ToString();
     }
 }
开发者ID:Xamarui,项目名称:IdentityServer3.Contrib.ElasticSearchEventService,代码行数:38,代码来源:LambdaString.cs

示例5: GetLiteral


//.........这里部分代码省略.........
 public virtual SqlStatement GetLiteral(ExpressionType operationType, IList<SqlStatement> args)
 {
     for(int i= 0; i < args.Count; i++)
       args[i] = EncloseParenth(args[i]);
     switch (operationType)  {
       case ExpressionType.Add:
           return GetLiteralAdd(args[0], args[1]);
       case ExpressionType.AddChecked:
           return GetLiteralAddChecked(args[0], args[1]);
       case ExpressionType.And:
           return GetLiteralAnd(args[0], args[1]);
       case (ExpressionType) SqlFunctionType.AndBitwise:
           return GetLiteralAndBitwise(args[0], args[1]);
       case ExpressionType.AndAlso:
           return GetLiteralAndAlso(args[0], args[1]);
       case ExpressionType.ArrayLength:
           return GetLiteralArrayLength(args[0], args[1]);
       case ExpressionType.ArrayIndex:
           return GetLiteralArrayIndex(args[0], args[1]);
       case ExpressionType.Call:
           return GetLiteralCall(args[0]);
       case ExpressionType.Coalesce:
           return GetLiteralCoalesce(args[0], args[1]);
       case ExpressionType.Conditional:
           return GetLiteralConditional(args[0], args[1], args[2]);
       //case ExpressionType.Constant:
       //break;
       case ExpressionType.Divide:
           return GetLiteralDivide(args[0], args[1]);
       case ExpressionType.Equal:
           return GetLiteralEqual(args[0], args[1]);
       case ExpressionType.ExclusiveOr:
           return GetLiteralExclusiveOr(args[0], args[1]);
       case ExpressionType.GreaterThan:
           return GetLiteralGreaterThan(args[0], args[1]);
       case ExpressionType.GreaterThanOrEqual:
           return GetLiteralGreaterThanOrEqual(args[0], args[1]);
       //case ExpressionType.Invoke:
       //break;
       //case ExpressionType.Lambda:
       //break;
       case ExpressionType.LeftShift:
           return GetLiteralLeftShift(args[0], args[1]);
       case ExpressionType.LessThan:
           return GetLiteralLessThan(args[0], args[1]);
       case ExpressionType.LessThanOrEqual:
           return GetLiteralLessThanOrEqual(args[0], args[1]);
       //case ExpressionType.ListInit:
       //break;
       //case ExpressionType.MemberAccess:
       //    break;
       //case ExpressionType.MemberInit:
       //    break;
       case ExpressionType.Modulo:
           return GetLiteralModulo(args[0], args[1]);
       case ExpressionType.Multiply:
           return GetLiteralMultiply(args[0], args[1]);
       case ExpressionType.MultiplyChecked:
           return GetLiteralMultiplyChecked(args[0], args[1]);
       case ExpressionType.Negate:
           return GetLiteralNegate(args[0]);
       case ExpressionType.UnaryPlus:
           return GetLiteralUnaryPlus(args[0]);
       case ExpressionType.NegateChecked:
           return GetLiteralNegateChecked(args[0]);
       //case ExpressionType.New:
       //    break;
       //case ExpressionType.NewArrayInit:
       //    break;
       //case ExpressionType.NewArrayBounds:
       //    break;
       case ExpressionType.Not:
           return GetLiteralNot(args[0]);
       case ExpressionType.NotEqual:
           return GetLiteralNotEqual(args[0], args[1]);
       case ExpressionType.Or:
           return GetLiteralOr(args[0], args[1]);
       case (ExpressionType) SqlFunctionType.OrBitwise:
           return GetLiteralOrBitwise(args[0], args[1]);
       case ExpressionType.OrElse:
           return GetLiteralOrElse(args[0], args[1]);
       //case ExpressionType.Parameter:
       //    break;
       case ExpressionType.Power:
           return GetLiteralPower(args[0], args[1]);
       //case ExpressionType.Quote:
       //    break;
       case ExpressionType.RightShift:
           return GetLiteralRightShift(args[0], args[1]);
       case ExpressionType.Subtract:
           return GetLiteralSubtract(args[0], args[1]);
       case ExpressionType.SubtractChecked:
           return GetLiteralSubtractChecked(args[0], args[1]);
       //case ExpressionType.TypeAs:
       //    break;
       //case ExpressionType.TypeIs:
       //    break;
     }
     throw new ArgumentException("Unsupported operator for expression type: " +  operationType.ToString());
 }
开发者ID:yuanfei05,项目名称:vita,代码行数:101,代码来源:LinqSqlProvider.cs

示例6: Terminal

 internal Terminal(ExpressionType type, Regex regex)
     : this(TokenType.ExpressionName, type.ToString(), regex)
 {
 }
开发者ID:modulexcite,项目名称:cs-schyntax,代码行数:4,代码来源:Terms.cs

示例7: OperatorToSql

 private string OperatorToSql(ExpressionType exprType, bool anyOperandNull)
 {
     if (anyOperandNull && exprType == ExpressionType.Equal)
         return "IS";
     if (anyOperandNull && exprType == ExpressionType.NotEqual)
         return "IS NOT";
     string opSql;
     if (!operatorTranslations.TryGetValue(exprType, out opSql))
         throw new NotSupportedException(string.Format("Operator {0} is not supported.", exprType.ToString()));
     return opSql;
 }
开发者ID:jacentino,项目名称:TypesafeSQL,代码行数:11,代码来源:SqlCommandBuilder.cs

示例8: GetOperatorSymbol

		static string GetOperatorSymbol(ExpressionType nodeType)
		{
			switch (nodeType) {
				case ExpressionType.AndAlso:
					return "AND";
				case ExpressionType.OrElse:
					return "OR";
				case ExpressionType.LessThan:
					return "<";
				case ExpressionType.LessThanOrEqual:
					return "<=";
				case ExpressionType.GreaterThan:
					return ">";
				case ExpressionType.GreaterThanOrEqual:
					return ">=";
				case ExpressionType.Equal:
					return "=";
				case ExpressionType.NotEqual:
					return "!=";
				default:
					throw new NotSupportedException(nodeType.ToString());
			}
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:23,代码来源:ExpressionSqlWriter.cs

示例9: GetUrlName

 private string GetUrlName(ExpressionType exprType)
 {
     switch (exprType)
     {
         case ExpressionType.GreaterThan:
             return "gt";
         case ExpressionType.GreaterThanOrEqual:
             return "ge";
         case ExpressionType.LessThan:
             return "lt";
         case ExpressionType.LessThanOrEqual:
             return "le";
         case ExpressionType.And:
         case ExpressionType.AndAlso:
             // Reset current property
             closeUnaryBooleanOperator();
             _currentProperty = null;
             return "and";
         case ExpressionType.Or:
         case ExpressionType.OrElse:
             // Reset current property
             closeUnaryBooleanOperator();
             _currentProperty = null;
             return "or";
         case ExpressionType.Equal:
             return "eq";
         case ExpressionType.NotEqual:
             return "ne";
         default:
             throw new System.NotSupportedException("Cannot get name for: " + exprType.ToString());
     }
 }
开发者ID:RossMerr,项目名称:azure-sdk-for-net,代码行数:32,代码来源:UrlExpressionVisitor.cs

示例10: RangeIntersect

        public static bool RangeIntersect(ExpressionType left_operator, SemanticVersion left, ExpressionType right_operator, SemanticVersion right)
        {
            if (left_operator != ExpressionType.LessThan && left_operator != ExpressionType.LessThanOrEqual &&
                    left_operator != ExpressionType.GreaterThan && left_operator != ExpressionType.GreaterThanOrEqual
                    && left_operator != ExpressionType.Equal)
                throw new ArgumentException("Unsupported left operator expression type " + left_operator.ToString() + ".");
            if (right_operator != ExpressionType.LessThan && right_operator != ExpressionType.LessThanOrEqual &&
                   right_operator != ExpressionType.GreaterThan && right_operator != ExpressionType.GreaterThanOrEqual
                   && right_operator != ExpressionType.Equal)
                throw new ArgumentException("Unsupported left operator expression type " + left_operator.ToString() + ".");

            if (left_operator == ExpressionType.Equal)
            {
                return InvokeBinaryExpression(GetBinaryExpression(right_operator, left, right));
            }
            else if (right_operator == ExpressionType.Equal)
            {
                return InvokeBinaryExpression(GetBinaryExpression(left_operator, right, left));
            }

            if ((left_operator == ExpressionType.LessThan || left_operator == ExpressionType.LessThanOrEqual)
                && (right_operator == ExpressionType.LessThan || right_operator == ExpressionType.LessThanOrEqual))
            {
                return true;
            }
            else if ((left_operator == ExpressionType.GreaterThan || left_operator == ExpressionType.GreaterThanOrEqual)
                && (right_operator == ExpressionType.GreaterThan || right_operator == ExpressionType.GreaterThanOrEqual))
            {
                return true;
            }

            else if ((left_operator == ExpressionType.LessThanOrEqual) && (right_operator == ExpressionType.GreaterThanOrEqual))
            {
                return right <= left;
            }

            else if ((left_operator == ExpressionType.GreaterThanOrEqual) && (right_operator == ExpressionType.LessThanOrEqual))
            {
                return right >= left;
            }


            else if ((left_operator == ExpressionType.LessThan || left_operator == ExpressionType.LessThanOrEqual)
                && (right_operator == ExpressionType.GreaterThan || right_operator == ExpressionType.GreaterThanOrEqual))
            {
                return right < left;
            }

            else
            {
                return right > left;
            }
        }
开发者ID:allisterb,项目名称:SemverSharp,代码行数:53,代码来源:SemanticVersionModel.cs

示例11: GetBinaryExpression


//.........这里部分代码省略.........
            ConstantExpression zero = Expression.Constant(0, typeof(int));
            ConstantExpression l = Expression.Constant(left, typeof(SemanticVersion));
            ConstantExpression r = Expression.Constant(right, typeof(SemanticVersion));
            ConstantExpression l_major = Expression.Constant(left.Major, typeof(int));
            ConstantExpression l_minor = left.Minor.HasValue ? Expression.Constant(left.Minor, typeof(int)) : Expression.Constant(0, typeof(int));
            ConstantExpression l_patch = left.Patch.HasValue ? Expression.Constant(left.Patch, typeof(int)) : Expression.Constant(0, typeof(int));
            ConstantExpression l_prerelease = Expression.Constant(left.PreRelease, typeof(PreRelease));
            ConstantExpression r_major = Expression.Constant(right.Major, typeof(int));
            ConstantExpression r_minor = right.Minor.HasValue ? Expression.Constant(right.Minor, typeof(int)) : zero;
            ConstantExpression r_patch = right.Patch.HasValue ? Expression.Constant(right.Patch, typeof(int)) : zero;
            ConstantExpression r_prerelease = Expression.Constant(right.PreRelease, typeof(PreRelease));
            BinaryExpression a = Expression.MakeBinary(et, l_major, r_major);
            BinaryExpression b = Expression.MakeBinary(et, l_minor, r_minor);
            BinaryExpression c = Expression.MakeBinary(et, l_patch, r_patch);
            BinaryExpression d = Expression.MakeBinary(et, l_prerelease, r_prerelease);
            if (et == ExpressionType.Equal || et == ExpressionType.NotEqual)
            {
                return Expression.AndAlso(Expression.AndAlso(a, Expression.AndAlso(b, c)), d);
            }
            else if (et == ExpressionType.LessThan || et == ExpressionType.GreaterThan)
            {
                if (!ReferenceEquals(right.PreRelease, null) && !ReferenceEquals(left.PreRelease, null))//Major + minor + patch + prerelease
                {
                    return Expression.AndAlso(Expression.AndAlso(Expression.AndAlso(Expression.MakeBinary(ExpressionType.Equal, l_major, r_major),
                        Expression.MakeBinary(ExpressionType.Equal, l_minor, r_minor)), Expression.MakeBinary(ExpressionType.Equal, l_patch, r_patch)), d);
                }
                else
                {
                    return Expression.OrElse(a,
                                Expression.OrElse(//  or major = major and b
                                    Expression.OrElse(Expression.AndAlso(Expression.MakeBinary(ExpressionType.Equal, l_major, r_major), b),
                                        Expression.AndAlso(Expression.AndAlso(Expression.MakeBinary(ExpressionType.Equal, l_major, r_major),
                                        Expression.MakeBinary(ExpressionType.Equal, l_minor, r_minor)), c)),
                                    Expression.AndAlso(Expression.AndAlso(Expression.AndAlso(Expression.MakeBinary(ExpressionType.Equal, l_major, r_major),
                                    Expression.MakeBinary(ExpressionType.Equal, l_minor, r_minor)), Expression.MakeBinary(ExpressionType.Equal, l_patch, r_patch)), d))
                            );
                }
                /*
                if (!right.Minor.HasValue) //Major only
                {
                    return a;
                }
                else if (!right.Patch.HasValue) //Major + minor
                {
                    return Expression.OrElse(a,
                        Expression.AndAlso(Expression.MakeBinary(ExpressionType.Equal, l_major, r_major), b));
                }

                else if (ReferenceEquals(right.PreRelease, null) && ReferenceEquals(left.PreRelease, null))//Major + minor + patch only
                {
                    return Expression.OrElse(a,
                            Expression.OrElse(Expression.AndAlso(Expression.MakeBinary(ExpressionType.Equal, l_major, r_major), b),
                                Expression.AndAlso(Expression.AndAlso(Expression.MakeBinary(ExpressionType.Equal, l_major, r_major), 
                                Expression.MakeBinary(ExpressionType.Equal, l_minor, r_minor)), c)
                            ));
                }

                else if (!ReferenceEquals(right.PreRelease, null) && !ReferenceEquals(left.PreRelease, null))//Major + minor + patch + prerelease
                {
                    return Expression.AndAlso(Expression.AndAlso(Expression.AndAlso(Expression.MakeBinary(ExpressionType.Equal, l_major, r_major),
                        Expression.MakeBinary(ExpressionType.Equal, l_minor, r_minor)), Expression.MakeBinary(ExpressionType.Equal, l_patch, r_patch)), d);
                }

                else //Major + minor + patch + 1 preonly
                {
                    return Expression.OrElse(a,
                            Expression.OrElse(//  or major = major and b
                                Expression.OrElse(Expression.AndAlso(Expression.MakeBinary(ExpressionType.Equal, l_major, r_major), b),
                                    Expression.AndAlso(Expression.AndAlso(Expression.MakeBinary(ExpressionType.Equal, l_major, r_major), 
                                    Expression.MakeBinary(ExpressionType.Equal, l_minor, r_minor)), c)),         
                                Expression.AndAlso(Expression.AndAlso(Expression.AndAlso(Expression.MakeBinary(ExpressionType.Equal, l_major, r_major),
                                Expression.MakeBinary(ExpressionType.Equal, l_minor, r_minor)), Expression.MakeBinary(ExpressionType.Equal, l_patch, r_patch)), d))
                        );
                }
                //                left.Major > right.Major ||
                //                    (left.Major == right.Major) && (left.Minor > right.Minor) ||
                //                    (left.Major == right.Major) && (left.Minor == right.Minor) && (left.Patch > right.Patch);
                */
 
            }

            else if (et == ExpressionType.LessThanOrEqual)
            {
                return Expression.OrElse(GetBinaryExpression(ExpressionType.LessThan, left, right), GetBinaryExpression(ExpressionType.Equal, left, right));
            }

            else if (et == ExpressionType.GreaterThanOrEqual)
            {
                return Expression.OrElse(GetBinaryExpression(ExpressionType.GreaterThan, left, right), GetBinaryExpression(ExpressionType.Equal, left, right));
            }


            else if (et == ExpressionType.OnesComplement)
            {
                return Expression.AndAlso(Expression.MakeBinary(ExpressionType.GreaterThan, l, r),
                    Expression.MakeBinary(ExpressionType.LessThanOrEqual, l, Expression.MakeUnary(ExpressionType.OnesComplement, r, null)));
            }
                       
            else throw new ArgumentException("Unimplemented expression type: " + et.ToString() + ".");
        }
开发者ID:allisterb,项目名称:SemverSharp,代码行数:101,代码来源:SemanticVersionModel.cs

示例12: BinaryExpression

        public BinaryExpression(ExpressionType nodeType, Expression left, Expression right)
            : base(nodeType)
        {
            this.Left = left;
            this.Right = right;

            switch (nodeType)
            {
                case ExpressionType.LeftShift:
                case ExpressionType.RightShift:
                case ExpressionType.Modulo:
                    ModelClass.LazyInit(this, TypeProperty, () => TypeHelpers.GetCommonType(this.Left.Type, this.Right.Type));
                    ModelClass.LazyInit(this.Left, ExpectedTypeProperty, () => BuiltInType.Long);
                    ModelClass.LazyInit(this.Right, ExpectedTypeProperty, () => BuiltInType.Long);
                    break;
                case ExpressionType.Add:
                case ExpressionType.Divide:
                case ExpressionType.Multiply:
                case ExpressionType.Subtract:
                    ModelClass.LazyInit(this, TypeProperty, () => TypeHelpers.GetCommonType(this.Left.Type, this.Right.Type));
                    ModelClass.LazyInit(this.Left, ExpectedTypeProperty, () => this.ExpectedType);
                    ModelClass.LazyInit(this.Right, ExpectedTypeProperty, () => this.ExpectedType);
                    break;
                case ExpressionType.Equal:
                case ExpressionType.GreaterThan:
                case ExpressionType.GreaterThanOrEqual:
                case ExpressionType.LessThan:
                case ExpressionType.LessThanOrEqual:
                case ExpressionType.NotEqual:
                    ModelClass.LazyInit(this, TypeProperty, () => BuiltInType.Bool);
                    ModelClass.LazyInit(this.Left, ExpectedTypeProperty, () => this.Right.Type);
                    ModelClass.LazyInit(this.Right, ExpectedTypeProperty, () => this.Left.Type);
                    break;
                case ExpressionType.And:
                case ExpressionType.AndAlso:
                case ExpressionType.ExclusiveOr:
                case ExpressionType.Or:
                case ExpressionType.OrElse:
                    ModelClass.LazyInit(this, TypeProperty, () => BuiltInType.Bool);
                    ModelClass.LazyInit(this.Left, ExpectedTypeProperty, () => BuiltInType.Bool);
                    ModelClass.LazyInit(this.Right, ExpectedTypeProperty, () => BuiltInType.Bool);
                    break;
                case ExpressionType.Coalesce:
                    ModelClass.LazyInit(this, TypeProperty, () => TypeHelpers.GetCommonType(((NullableType)this.Left.Type).InnerType, this.Right.Type));
                    ModelClass.LazyInit(this.Left, ExpectedTypeProperty, () => NullableType.CreateFrom((Type)this.ExpectedType));
                    ModelClass.LazyInit(this.Right, ExpectedTypeProperty, () => this.ExpectedType);
                    break;
                default:
                    throw new SoaModelException("Invalid binary expression type: " + nodeType.ToString());
            }
            ModelClass.LazyInit(this, ValueProperty, () => { throw new EvaluationException(this); });

            this.Children.Add(this.Left);
            this.Children.Add(this.Right);
        }
开发者ID:st9200,项目名称:soal-oslo,代码行数:55,代码来源:Expression.cs

示例13: BindOperant

 protected string BindOperant(ExpressionType e)
 {
     switch (e)
     {
         case ExpressionType.Equal:
             return "=";
         case ExpressionType.NotEqual:
             return "<>";
         case ExpressionType.GreaterThan:
             return ">";
         case ExpressionType.GreaterThanOrEqual:
             return ">=";
         case ExpressionType.LessThan:
             return "<";
         case ExpressionType.LessThanOrEqual:
             return "<=";
         case ExpressionType.AndAlso:
             return "AND";
         case ExpressionType.OrElse:
             return "OR";
         case ExpressionType.Add:
             return "+";
         case ExpressionType.Subtract:
             return "-";
         case ExpressionType.Multiply:
             return "*";
         case ExpressionType.Divide:
             return "/";
         case ExpressionType.Modulo:
             return "MOD";
         case ExpressionType.Coalesce:
             return "COALESCE";
         default:
             return e.ToString();
     }
 }
开发者ID:chriswalpen,项目名称:PersistenceMap,代码行数:36,代码来源:LambdaToSqlCompiler.cs

示例14: ResolveOperation

 void ResolveOperation(ExpressionType op)
 {
     switch (op)
     {
         case ExpressionType.And:
         case ExpressionType.AndAlso:
             _builder.And();
             break;
         case ExpressionType.Or:
         case ExpressionType.OrElse:
             _builder.Or();
             break;
         default:
             throw new ArgumentException(string.Format("Unrecognized binary expression operation '{0}'", op.ToString()));
     }
 }
开发者ID:RealityDaemon,项目名称:MVC-and-MVVM-examples,代码行数:16,代码来源:LambdaResolverTree.cs

示例15: UnknownOperatorException

 public UnknownOperatorException(ExpressionType unknownOperator)
     : base("We don't know what to do with the Operator: " + unknownOperator.ToString())
 {
     this.UnknownOperator = unknownOperator;
 }
开发者ID:brad-jones,项目名称:graceful,代码行数:5,代码来源:Exceptions.cs


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