• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Expressions.NewArrayExpression类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Linq.Expressions.NewArrayExpression的典型用法代码示例。如果您正苦于以下问题:C# NewArrayExpression类的具体用法?C# NewArrayExpression怎么用?C# NewArrayExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



NewArrayExpression类属于System.Linq.Expressions命名空间,在下文中一共展示了NewArrayExpression类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: NewArrayInit

 internal static NewArrayInit NewArrayInit(NewArrayExpression expression)
 {
     return new NewArrayInit()
     {
         Type = TypeRef.Serialize(expression.Type.GetElementType()),
         Expressions = expression.Expressions.Any()
             ? expression.Expressions.Select(Serialize).ToArray()
             : null,
     }.Apply(n => n.Type = TypeRef.Serialize(expression.Type));
 }
开发者ID:takeshik,项目名称:yacq,代码行数:10,代码来源:NewArrayInit.cs


示例2: CreateParamArrayConstraint

        private IArgumentConstraint CreateParamArrayConstraint(NewArrayExpression expression)
        {
            var result = new List<IArgumentConstraint>();

            foreach (var argumentExpression in expression.Expressions)
            {
                result.Add(this.GetArgumentConstraintFromExpression(argumentExpression));
            }

            return new AggregateArgumentConstraint(result);
        }
开发者ID:NameOfTheDragon,项目名称:FakeItEasy,代码行数:11,代码来源:ExpressionArgumentConstraintFactory.cs


示例3: VisitNewArray

        protected override Expression VisitNewArray(NewArrayExpression node)
        {
            List<Visitor> elementVisitors = node.Expressions.Select(_ => new Visitor()).ToList();
            List<Expression> elementExpressions = elementVisitors.Zip(node.Expressions, (v, e) => v.Visit(e)).ToList();

            NewArrayExpression arrayExpression = Expression.NewArrayInit(elementExpressions.First().Type, elementExpressions);

            foreach (Visitor visitor in elementVisitors)
                _captureNode.AddChild(visitor.CaptureNode);

            return arrayExpression;
        }
开发者ID:gredman,项目名称:worse,代码行数:12,代码来源:Visitor.cs


示例4: ProcessNewArrayExpression

 protected virtual Expression ProcessNewArrayExpression(NewArrayExpression expression)
 {
     var notFirst = false;
     foreach (var member in expression.Expressions)
     {
         if (notFirst)
             CommandTextBuilder.Append(",");
         
         ProcessExpression(member);
         notFirst = true;
     }
     return expression;
 }
开发者ID:mdcuesta,项目名称:anito.net,代码行数:13,代码来源:AdoTranslatorBase.cs


示例5: ParseExpression

 static Node ParseExpression(NewArrayExpression e)
 {
     switch (e.NodeType)
     {
         case ExpressionType.NewArrayInit:
             Type t = e.Type.GetElementType();
             return new NewArrayNode
             {
                 Items = e.Expressions.Select(Parse).ToList(),
                 Type = NameOfType(t)
             };
         case ExpressionType.NewArrayBounds:
         //todo:
         default:
             throw new ArgumentOutOfRangeException();
     }
 }
开发者ID:joshrobb,项目名称:PowerAssert.Net,代码行数:17,代码来源:ExpressionParser.cs


示例6: VisitNewArray

        protected override Expression VisitNewArray(NewArrayExpression node)
        {
            if (node.Type != typeof(Byte[]))
            {
                String message = String.Format("Resources.ExpressionEvaluatorTypeNotSupported {0}", node.Type);
                throw new NotSupportedException(message);
            }

            var array = new Byte[node.Expressions.Count];

            for (int i = 0; i < node.Expressions.Count; i++)
            {
                ConstantExpression result = TryToEvaluate(node.Expressions[i]);
                array[i] = (Byte)result.Value;
            }

            return Expression.Constant(array, node.Type);
        }
开发者ID:s-innovations,项目名称:azure-table-storage-repository-pattern,代码行数:18,代码来源:ExpressionEvaluator.cs


示例7: VisitNewArray

		protected override Expression VisitNewArray(NewArrayExpression expression)
		{
			if (expression.Type.GetArrayRank() == 1 && !expression.Type.GetElementType().IsDataAccessObjectType())
			{
				if (expression.Expressions.All(c => c.Type.IsDataAccessObjectType()))
				{
					if (expression.NodeType == ExpressionType.NewArrayInit)
					{
						return Expression.NewArrayInit(typeof(DataAccessObject), this.VisitExpressionList(expression.Expressions));
					}
					else
					{
						return Expression.NewArrayBounds(typeof(DataAccessObject), this.VisitExpressionList(expression.Expressions));
					}
				}
			}

			return base.VisitNewArray(expression);
		}
开发者ID:tumtumtum,项目名称:Shaolinq,代码行数:19,代码来源:ProjectionBuilder.cs


示例8: VisitNewArray

 protected override Expression VisitNewArray(NewArrayExpression na)
 {
     this.Write("new ");
     this.Write(this.GetTypeName(TypeHelper.GetElementType(na.Type)));
     this.Write("[] {");
     if (na.Expressions.Count > 1)
         this.WriteLine(Indentation.Inner);
     this.VisitExpressionList(na.Expressions);
     if (na.Expressions.Count > 1)
         this.WriteLine(Indentation.Outer);
     this.Write("}");
     return na;
 }
开发者ID:PaybackMan,项目名称:Cinder,代码行数:13,代码来源:ExpressionWriter.cs


示例9: CreateArrayInitExpressions

        static IEnumerable<Expression> CreateArrayInitExpressions(NewArrayExpression newArray, Expression valueExpression, Expression indexExpression)
        {
            if (newArray.NodeType == ExpressionType.NewArrayInit)
            {
                var indexGetter = (Func<int>) Expression.Lambda(indexExpression).Compile();
                var index = indexGetter();
                var expressions = newArray.Expressions.ToArray();

                if (index >= newArray.Expressions.Count)
                {
                    Array.Resize(ref expressions, index + 1);
                }

                expressions[index] = valueExpression;

                return expressions;
            }

            return new[] {valueExpression};
        }
开发者ID:bensho,项目名称:DelegateDecompiler,代码行数:20,代码来源:Processor.cs


示例10: UpdateNewArray

 protected NewArrayExpression UpdateNewArray(NewArrayExpression na, Type arrayType, IEnumerable<Expression> expressions)
 {
     if (expressions != na.Expressions || na.Type != arrayType)
     {
         if (na.NodeType == ExpressionType.NewArrayInit)
         {
             return Expression.NewArrayInit(arrayType.GetElementType(), expressions);
         }
         else
         {
             return Expression.NewArrayBounds(arrayType.GetElementType(), expressions);
         }
     }
     return na;
 }
开发者ID:Bitwix,项目名称:XeroAPI.Net,代码行数:15,代码来源:ExpressionVisitor.cs


示例11: VisitNewArray

 protected virtual Expression VisitNewArray(NewArrayExpression na)
 {
     IEnumerable<Expression> exprs = this.VisitExpressionList(na.Expressions);
     return this.UpdateNewArray(na, na.Type, exprs);
 }
开发者ID:Bitwix,项目名称:XeroAPI.Net,代码行数:5,代码来源:ExpressionVisitor.cs


示例12: VisitNewArray

 internal override Expression VisitNewArray(NewArrayExpression na)
 {
     throw new NotSupportedException(Strings.ALinq_NewArrayNotSupported);
 }
开发者ID:nlhepler,项目名称:mono,代码行数:4,代码来源:UriWriter.cs


示例13: VisitNewArray

 protected virtual System.Linq.Expressions.Expression VisitNewArray(NewArrayExpression na)
 {
     IEnumerable<System.Linq.Expressions.Expression> exprs = VisitExpressionList(na.Expressions);
     // ReSharper disable once PossibleUnintendedReferenceComparison
     if(exprs != na.Expressions)
     {
         if(na.NodeType == ExpressionType.NewArrayInit)
         {
             return System.Linq.Expressions.Expression.NewArrayInit(na.Type.GetElementType(), exprs);
         }
         return System.Linq.Expressions.Expression.NewArrayBounds(na.Type.GetElementType(), exprs);
     }
     return na;
 }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:14,代码来源:ExpressionVisitor.cs


示例14: VisitNewArray

        /// <summary>
        /// Visit a new array expression.
        /// </summary>
        /// <param name="newArrayExp"></param>
        /// <returns></returns>
        protected virtual Expression VisitNewArray(NewArrayExpression newArrayExp)
        {
            IEnumerable<Expression> exprs = VisitList(newArrayExp.Expressions);
            if (exprs != newArrayExp.Expressions)
            {
                return newArrayExp.NodeType == ExpressionType.NewArrayInit
                    ? Expression.NewArrayInit(newArrayExp.Type.GetElementType(), exprs)
                    : Expression.NewArrayBounds(newArrayExp.Type.GetElementType(), exprs);
            }

            return newArrayExp;
        }
开发者ID:jd-pantheon,项目名称:Titan-Framework-v2,代码行数:17,代码来源:ExpressionVisitor.cs


示例15: VisitNewArray

 internal override Expression VisitNewArray(NewArrayExpression na)
 {
     throw new NotSupportedException(Strings.ALinq_ExpressionNotSupportedInProjectionToEntity(this.type, na.ToString()));
 }
开发者ID:JianwenSun,项目名称:cc,代码行数:4,代码来源:ProjectionAnalyzer.cs


示例16: CompileNewArrayFromExpressionList

 protected virtual IList<object> CompileNewArrayFromExpressionList(NewArrayExpression na)
 {
     return CompileExpressionList(na.Expressions);
 }
开发者ID:chriswalpen,项目名称:PersistenceMap,代码行数:4,代码来源:LambdaToSqlCompiler.cs


示例17: CompileNewArray

        protected virtual object CompileNewArray(NewArrayExpression na)
        {
            var exprs = CompileExpressionList(na.Expressions);
            var sb = new StringBuilder();
            foreach (var e in exprs)
            {
                sb.Append(sb.Length > 0 ? "," + e : e);
            }

            return sb.ToString();
        }
开发者ID:chriswalpen,项目名称:PersistenceMap,代码行数:11,代码来源:LambdaToSqlCompiler.cs


示例18: CreateInRangeExpression

        private Expression CreateInRangeExpression(Expression leftExpression, NewArrayExpression asRightRange)
        {
            var lower = (asRightRange.Expressions[0] as ConstantExpression).Value;
            var upper = (asRightRange.Expressions[1] as ConstantExpression).Value;

            lower = ChangeType(lower, leftExpression.Type);
            upper = ChangeType(upper, leftExpression.Type);

            if (Modifier == ModifierTypes.LessThan)
            {
                return Expression.LessThan(leftExpression, Expression.Constant(lower));
            }
            if (Modifier == ModifierTypes.GreaterThan)
            {
                return Expression.GreaterThan(leftExpression, Expression.Constant(upper));
            }
            else
            {
                if (lower.Equals(upper))
                {
                    return Expression.Equal(leftExpression, Expression.Constant(lower));
                }
                else
                {
                    return Expression.AndAlso
                    (
                        Expression.LessThanOrEqual(leftExpression, Expression.Constant(upper)),
                        Expression.GreaterThanOrEqual(leftExpression, Expression.Constant(lower))
                    );
                }
            }
        }
开发者ID:yonglehou,项目名称:Bermuda,代码行数:32,代码来源:SelectorExpression.cs


示例19: VisitNewArray

 /// <summary>
 /// NewArrayExpression visit method
 /// </summary>
 /// <param name="na">The NewArrayExpression to visit</param>
 /// <returns>The visited NewArrayExpression</returns>
 internal override Expression VisitNewArray(NewArrayExpression na)
 {
     throw new NotImplementedException();
 }
开发者ID:larsenjo,项目名称:odata.net,代码行数:9,代码来源:NonClrExpressionTreeToXmlSerializer.cs


示例20: VisitNewArrayExpression

		protected HqlTreeNode VisitNewArrayExpression(NewArrayExpression expression)
		{
			var visitor = new HqlGeneratorExpressionTreeVisitor(_parameters);
			var expressionSubTree = expression.Expressions.Select(exp => visitor.Visit(exp));
			return _hqlTreeBuilder.ExpressionSubTreeHolder(expressionSubTree);
		}
开发者ID:khaliyo,项目名称:Spring.net-NHibernate.net-Asp.net-MVC-DWZ-,代码行数:6,代码来源:HqlGeneratorExpressionTreeVisitor.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Expressions.NewExpression类代码示例发布时间:2022-05-26
下一篇:
C# Expressions.MethodCallExpression类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap