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


C# InvocationExpression.Clone方法代码示例

本文整理汇总了C#中InvocationExpression.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# InvocationExpression.Clone方法的具体用法?C# InvocationExpression.Clone怎么用?C# InvocationExpression.Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在InvocationExpression的用法示例。


在下文中一共展示了InvocationExpression.Clone方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddFormatCallToInvocation

		void AddFormatCallToInvocation (RefactoringContext context, Script script, PrimitiveExpression pExpr, InvocationExpression invocation)
		{
			var newInvocation = (InvocationExpression)invocation.Clone ();
			
			newInvocation.Arguments.First ().ReplaceWith (CreateFormatString (context, pExpr, newInvocation.Arguments.Count () - 1));
			newInvocation.Arguments.Add (CreateFormatArgument (context));
			
			script.Replace (invocation, newInvocation);
		}
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:9,代码来源:IntroduceFormatItemAction.cs

示例2: AddArgument

			void AddArgument(Script script, InvocationExpression invocationExpression, string stringComparison)
			{
				var astBuilder = ctx.CreateTypeSytemAstBuilder(invocationExpression);
				var newArgument = astBuilder.ConvertType(new TopLevelTypeName("System", "StringComparison")).Member(stringComparison);
				var copy = (InvocationExpression)invocationExpression.Clone();
				copy.Arguments.Add(newArgument);
				script.Replace(invocationExpression, copy);
			}
开发者ID:RainsSoft,项目名称:playscript-monodevelop,代码行数:8,代码来源:MissingStringComparisonIssue.cs

示例3: VisitInvocationExpression

			public override void VisitInvocationExpression (InvocationExpression invocationExpression)
			{
				base.VisitInvocationExpression (invocationExpression);

				var hasRefs = invocationExpression.Arguments.OfType<DirectionExpression> ().Any ();

				if (hasRefs) {

					var args = invocationExpression.Arguments.OfType<DirectionExpression> ().ToList ();

					var target = invocationExpression.Target;

					var lblock = new BlockStatement {

					};

					for (int i = 0; i < args.Count; i++) {
						var a = args [i];
						var vname = "_p" + i;
						var va = new VariableDeclarationStatement (AstType.Null, vname, new ArrayCreateExpression {
							Initializer = new ArrayInitializerExpression (a.Expression.Clone ())
						});
						a.ReplaceWith (new IdentifierExpression (vname));
						lblock.Add (va);
					}
					var rname = "_r";
					var ra = new VariableDeclarationStatement (AstType.Null, rname, invocationExpression.Clone ());
					lblock.Add (ra);
					for (int i = 0; i < args.Count; i++) {
						var a = args [i];
						var vname = "_p" + i;
						var va = new AssignmentExpression (a.Expression.Clone (), 
							new IndexerExpression (
								new IdentifierExpression (vname), new PrimitiveExpression (0)));
						lblock.Add (va);
					}
					lblock.Add (new ReturnStatement (new IdentifierExpression (rname)));

					var lambda = new LambdaExpression {
						Body = lblock,
					};

					var ilambda = new InvocationExpression (lambda);

					invocationExpression.ReplaceWith (ilambda);
				}
			}
开发者ID:RReverser,项目名称:Netjs,代码行数:47,代码来源:CsToTs.cs


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