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


C# Invocation.CreateExpressionTree方法代码示例

本文整理汇总了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);
		}
开发者ID:psni,项目名称:mono,代码行数:23,代码来源:delegate.cs

示例2: CreateExpressionTree

		public override Expression CreateExpressionTree (ResolveContext ec)
		{
			var invoke = new Invocation (expr, arguments);
			return invoke.CreateExpressionTree (ec);
		}
开发者ID:rlfqudxo,项目名称:playscript-mono,代码行数:5,代码来源:intrinsics.cs

示例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);
		}
开发者ID:BogdanovKirill,项目名称:mono,代码行数:35,代码来源:delegate.cs

示例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);
		}
开发者ID:lewurm,项目名称:benchmarker,代码行数:18,代码来源:delegate.cs


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