本文整理匯總了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);
}