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