本文整理匯總了C#中Mono.CSharp.Invocation.CreateExpressionTree方法的典型用法代碼示例。如果您正苦於以下問題:C# Invocation.CreateExpressionTree方法的具體用法?C# Invocation.CreateExpressionTree怎麽用?C# Invocation.CreateExpressionTree使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Mono.CSharp.Invocation
的用法示例。
在下文中一共展示了Invocation.CreateExpressionTree方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: CreateExpressionTree
public override Expression CreateExpressionTree (ResolveContext ec)
{
MemberAccess ma = new MemberAccess (new MemberAccess (new QualifiedAliasMember ("global", "System", loc), "Delegate", loc), "CreateDelegate", loc);
Arguments args = new Arguments (3);
args.Add (new Argument (new TypeOf (type, loc)));
if (method_group.InstanceExpression == null)
args.Add (new Argument (new NullLiteral (loc)));
else
args.Add (new Argument (method_group.InstanceExpression));
args.Add (new Argument (method_group.CreateExpressionTree (ec)));
Expression e = new Invocation (ma, args).Resolve (ec);
if (e == null)
return null;
e = Convert.ExplicitConversion (ec, e, type, loc);
if (e == null)
return null;
return e.CreateExpressionTree (ec);
}
示例2: CreateExpressionTree
public override Expression CreateExpressionTree (ResolveContext ec)
{
var invoke = new Invocation (expr, arguments);
return invoke.CreateExpressionTree (ec);
}
示例3: CreateExpressionTree
public override Expression CreateExpressionTree (ResolveContext ec)
{
Arguments args = new Arguments (2);
args.Add (new Argument (new TypeOf (type, loc)));
if (method_group.InstanceExpression == null)
args.Add (new Argument (new NullLiteral (loc)));
else
args.Add (new Argument (method_group.InstanceExpression));
Expression ma;
var create_v45 = ec.Module.PredefinedMembers.MethodInfoCreateDelegate.Get ();
if (create_v45 != null) {
//
// .NET 4.5 has better API but it produces different instance than Delegate::CreateDelegate
// and because csc uses this enhancement we have to as well to be fully compatible
//
var mg = MethodGroupExpr.CreatePredefined (create_v45, create_v45.DeclaringType, loc);
mg.InstanceExpression = method_group.CreateExpressionTree (ec);
ma = mg;
} else {
ma = new MemberAccess (new MemberAccess (new QualifiedAliasMember ("global", "System", loc), "Delegate", loc), "CreateDelegate", loc);
args.Add (new Argument (method_group.CreateExpressionTree (ec)));
}
Expression e = new Invocation (ma, args).Resolve (ec);
if (e == null)
return null;
e = Convert.ExplicitConversion (ec, e, type, loc);
if (e == null)
return null;
return e.CreateExpressionTree (ec);
}
示例4: CreateExpressionTree
public override Expression CreateExpressionTree (EmitContext ec)
{
MemberAccess ma = new MemberAccess (new MemberAccess (new QualifiedAliasMember ("global", "System", loc), "Delegate", loc), "CreateDelegate", loc);
ArrayList args = new ArrayList (3);
args.Add (new Argument (new TypeOf (new TypeExpression (type, loc), loc)));
args.Add (new Argument (new NullLiteral (loc)));
args.Add (new Argument (new TypeOfMethodInfo (delegate_method, loc)));
Expression e = new Invocation (ma, args).Resolve (ec);
if (e == null)
return null;
e = Convert.ExplicitConversion (ec, e, type, loc);
if (e == null)
return null;
return e.CreateExpressionTree (ec);
}