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


C# InvocationExpression.ToString方法代码示例

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


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

示例1: VisitInvocation

            /// <summary>
            /// We are doing an inline call to a lambda expression.
            /// </summary>
            /// <param name="expression"></param>
            /// <returns></returns>
            protected override Expression VisitInvocation(InvocationExpression expression)
            {
                ///
                /// Declare all the parameters for lookup.
                /// 

                if (!(expression.Expression is LambdaExpression))
                    throw new NotImplementedException("Do not know how to invoke a non-lambda call like '" + expression.ToString() + "'");

                var lambda = expression.Expression as LambdaExpression;

                var paramArgs = lambda.Parameters.Zip(expression.Arguments, (p, a) => Tuple.Create(p, a));
                var paramDefineToPopers = from pair in paramArgs
                                          select CodeContext.Add(pair.Item1.Name, pair.Item2);
                var allParamDefineToPopers = paramDefineToPopers.ToArray();

                ///
                /// Do the work. We parse the body of the lambda expression. The references to the parameters should be automatically
                /// dealt with.
                /// 

                var result = lambda.Body.Resolve(GeneratedCode, CodeContext, MEFContainer);

                ///
                /// Now, pop everything off!
                /// 

                foreach (var param in allParamDefineToPopers)
                {
                    param.Pop();
                }

                ///
                /// Done!
                /// 

                return result;
            }
开发者ID:gordonwatts,项目名称:LINQtoROOT,代码行数:43,代码来源:ExpressionResolver.cs

示例2: VisitInvocation

            internal override Expression VisitInvocation(InvocationExpression iv)
            {
                if (ClientType.CheckElementTypeIsEntity(iv.Expression.Type) || IsCollectionProducingExpression(iv.Expression) 
                    || iv.Arguments.Any(a => ClientType.CheckElementTypeIsEntity(a.Type) || IsCollectionProducingExpression(a)))
                {
                    throw new NotSupportedException(Strings.ALinq_ExpressionNotSupportedInProjection(this.type, iv.ToString()));
                }

                return base.VisitInvocation(iv);
            }
开发者ID:JianwenSun,项目名称:cc,代码行数:10,代码来源:ProjectionAnalyzer.cs

示例3: VisitInvocation

            internal override Expression VisitInvocation(InvocationExpression iv)
            {
                if (CommonUtil.IsClientType(iv.Expression.Type)
                    || iv.Arguments.Any(a => CommonUtil.IsClientType(a.Type)))
                {
                    throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, SR.ALinqExpressionNotSupportedInProjection, this.type, iv.ToString()));
                }

                return base.VisitInvocation(iv);
            }
开发者ID:huoxudong125,项目名称:azure-sdk-for-net,代码行数:10,代码来源:ProjectionAnalyzer.cs

示例4: VisitInvocation

 internal override Expression VisitInvocation(InvocationExpression iv)
 {
     if ((ClientTypeUtil.TypeOrElementTypeIsEntity(iv.Expression.Type) || ProjectionAnalyzer.IsCollectionProducingExpression(iv.Expression)) || iv.Arguments.Any<Expression>(delegate (Expression a) {
         if (!ClientTypeUtil.TypeOrElementTypeIsEntity(a.Type))
         {
             return ProjectionAnalyzer.IsCollectionProducingExpression(a);
         }
         return true;
     }))
     {
         throw new NotSupportedException(System.Data.Services.Client.Strings.ALinq_ExpressionNotSupportedInProjection(this.type, iv.ToString()));
     }
     return base.VisitInvocation(iv);
 }
开发者ID:nickchal,项目名称:pash,代码行数:14,代码来源:ProjectionAnalyzer.cs


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