當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。