本文整理汇总了C#中System.Linq.Expressions.Expression.ToList方法的典型用法代码示例。如果您正苦于以下问题:C# Expression.ToList方法的具体用法?C# Expression.ToList怎么用?C# Expression.ToList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Linq.Expressions.Expression
的用法示例。
在下文中一共展示了Expression.ToList方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: New
public static NewExpression New(ConstructorInfo constructor, Expression[] arguments)
{
var Type = default(Type);
if ((object)constructor != null)
Type = constructor.DeclaringType;
// X:\jsc.svn\examples\javascript\LINQ\test\auto\TestSelect\JVMCLRSyntaxOrderByThenGroupBy\Program.cs
//Console.WriteLine("Expression.New " + new
//{
// constructor,
// Type
// //, constructor.DeclaringType
//});
// method: System.Linq.Expressions.NewExpression New(System.Reflection.ConstructorInfo, System.Linq.Expressions.Expression[])
// X:\jsc.svn\examples\javascript\forms\Test\TestSQLiteGroupBy\TestSQLiteGroupBy\ApplicationWebService.cs
return
(NewExpression)(object)
new __NewExpression
{
NodeType = ExpressionType.New,
Constructor = constructor,
Type = Type,
Arguments = new global::System.Collections.ObjectModel.ReadOnlyCollection<Expression>(arguments.ToList()),
Members = new global::System.Collections.ObjectModel.ReadOnlyCollection<MemberInfo>(new MemberInfo[0].ToList()),
};
}
示例2: dynamicInvoke
Expression dynamicInvoke(Expression delegateExpr, Expression[] args)
{
var targetArgExprs = args.ToList();
targetArgExprs.Insert(0, delegateExpr);
return createCallSiteInvokeTarget(
"CreateInvokeBinder",
new [] { getNewCallInfoExpr(args.Length) },
targetArgExprs.ToArray());
}
示例3: ParseDynamicMethodInvocation
private static Expression ParseDynamicMethodInvocation(Type type, Expression instance, string methodName, Expression[] args)
{
var argsDynamic = args.ToList();
argsDynamic.Insert(0, instance);
var binderM = Microsoft.CSharp.RuntimeBinder.Binder.InvokeMember(
CSharpBinderFlags.None,
methodName,
null,
type,
argsDynamic.Select(x => CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null))
);
return Expression.Dynamic(binderM, typeof(object), argsDynamic);
}