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


C# CodeStatementCollection.AddRange方法代码示例

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


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

示例1: GenerateCodeInvocation

        public CodeStatementCollection GenerateCodeInvocation( AssignActivity assignActivity)
        {
            var invocationCodeCollection = new CodeStatementCollection();
            invocationCodeCollection.AddRange(DefaultActivityBuilder.LogActivity(assignActivity));

            invocationCodeCollection.AddRange(this.xslBuilder.Build(assignActivity.InputBindings));

            var variableToAssignReference = new CodeFieldReferenceExpression ( new CodeThisReferenceExpression (), VariableHelper.ToVariableName(assignActivity.VariableName));
            var codeInvocation = new CodeAssignStatement (variableToAssignReference, new CodeVariableReferenceExpression(VariableHelper.ToVariableName(assignActivity.VariableName)));
            invocationCodeCollection.Add(codeInvocation);
            return invocationCodeCollection;
        }
开发者ID:swoog,项目名称:EaiConverter,代码行数:12,代码来源:AssignActivityBuilder.cs

示例2: Constructor1_Deny_Unrestricted

		public void Constructor1_Deny_Unrestricted ()
		{
			CodeStatementCollection coll = new CodeStatementCollection (array);
			coll.CopyTo (array, 0);
			Assert.AreEqual (1, coll.Add (cs), "Add");
			Assert.AreSame (cs, coll[0], "this[int]");
			coll.AddRange (array);
			coll.AddRange (coll);
			Assert.IsTrue (coll.Contains (cs), "Contains");
			Assert.AreEqual (0, coll.IndexOf (cs), "IndexOf");
			coll.Insert (0, cs);
			coll.Remove (cs);
		}
开发者ID:nlhepler,项目名称:mono,代码行数:13,代码来源:CodeStatementCollectionCas.cs

示例3: GenerateCodeInvocation

        public CodeStatementCollection GenerateCodeInvocation(WriteToLogActivity activity)
        {
            var invocationCodeCollection = new CodeStatementCollection();

            // add log
            invocationCodeCollection.AddRange(DefaultActivityBuilder.LogActivity(activity));
            //add the input
            invocationCodeCollection.AddRange(this.xslBuilder.Build(activity.InputBindings));

            //Add the logger call
            invocationCodeCollection.Add(this.GenerateLoggerCodeInvocation(activity));

            return invocationCodeCollection;
        }
开发者ID:swoog,项目名称:EaiConverter,代码行数:14,代码来源:WriteToLogActivityBuilder.cs

示例4: GenerateCodeInvocation

        public CodeStatementCollection GenerateCodeInvocation(GenerateErrorActivity activity)
        {
            var invocationCodeCollection = new CodeStatementCollection();

            // add log
            invocationCodeCollection.AddRange(DefaultActivityBuilder.LogActivity(activity));
            //add the input
            invocationCodeCollection.AddRange(this.xslBuilder.Build(activity.InputBindings));

            // Add the exception Call
            invocationCodeCollection.Add(this.GenerateExceptionStatement(activity));

            return invocationCodeCollection;
        }
开发者ID:swoog,项目名称:EaiConverter,代码行数:14,代码来源:GenerateErrorActivityBuilder.cs

示例5: GenerateCoreGroupMethod

        private CodeStatementCollection GenerateCoreGroupMethod(GroupActivity groupActivity)
        {
            var invocationCodeCollection = new CodeStatementCollection();

            invocationCodeCollection.AddRange(this.coreProcessBuilder.GenerateStartCodeStatement(groupActivity.Transitions, "start", null, this.activityNameToServiceNameDictionnary));
            return invocationCodeCollection;
        }
开发者ID:swoog,项目名称:EaiConverter,代码行数:7,代码来源:GroupActivityBuilder.cs

示例6: DefaultInvocationMethod

        public CodeStatementCollection DefaultInvocationMethod(Activity activity)
        {
            var invocationCodeCollection = new CodeStatementCollection();
            invocationCodeCollection.AddRange(DefaultActivityBuilder.LogActivity(activity));

            return invocationCodeCollection;
        }
开发者ID:swoog,项目名称:EaiConverter,代码行数:7,代码来源:NullActivityBuilder.cs

示例7: PreshaderSrc

		public PreshaderSrc(AsmListing listing, CodeStatementCollection statementCollection)
		{
			statements = new List<CodeStatement>();

			object[] paramsArray = new object[1];
			StringBuilder sb = new StringBuilder();

			foreach (AsmCommand cmd in listing.Commands)
			{
				
				MethodInfo method;
				if (!methodList.TryGetValue(cmd.Target, out method))
				{
					if (cmd.Target == "preshader")
						continue;

					throw new CompileException(string.Format("Error decoding PreShader: Unexpected command '{0}'", cmd.Target));
				}

				string[] args = new string[cmd.OpCount];
				for (int i = 0; i < cmd.OpCount; i++)
				{
					cmd.GetOp(i).ToString(sb);
					args[i] = sb.ToString();
					sb.Length = 0;
				}
				paramsArray[0] = args;

				method.Invoke(this, paramsArray);
			}

			statementCollection.AddRange(this.statements.ToArray());
		}
开发者ID:shadarath,项目名称:Wirtualna-rzeczywistosc,代码行数:33,代码来源:PreshaderSrc.cs

示例8: DefaultInvocationMethod

 public CodeStatementCollection DefaultInvocationMethod(Activity activity)
 {
     var activityServiceReference = new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), VariableHelper.ToVariableName(activity.Name));
     var methodInvocation = new CodeMethodInvokeExpression(activityServiceReference, "Execute", new CodeExpression[] { });
     var invocationCodeCollection = new CodeStatementCollection();
     invocationCodeCollection.AddRange(LogActivity(activity));
     invocationCodeCollection.Add(methodInvocation);
     return invocationCodeCollection;
 }
开发者ID:swoog,项目名称:EaiConverter,代码行数:9,代码来源:DefaultActivityBuilder.cs

示例9: GenerateCodeInvocation

        public CodeStatementCollection GenerateCodeInvocation( MapperActivity mapperActivity)
        {
            var invocationCodeCollection = new CodeStatementCollection();
            // Add the Log
            invocationCodeCollection.AddRange(DefaultActivityBuilder.LogActivity(mapperActivity));
            // Add the mapping
            invocationCodeCollection.AddRange(this.xslBuilder.Build(mapperActivity.InputBindings));

            // Add the invocation
            var variableReturnType = mapperActivity.XsdReference.Split(':')[1];
            var variableName = VariableHelper.ToVariableName(mapperActivity.Name);

            var parameter = new CodeVariableReferenceExpression(mapperActivity.Parameters[0].Name);

            var code = new CodeVariableDeclarationStatement (variableReturnType, variableName, parameter);

            invocationCodeCollection.Add(code);

            return invocationCodeCollection;
        }
开发者ID:swoog,项目名称:EaiConverter,代码行数:20,代码来源:MapperActivityBuilder.cs

示例10: SerializeProperties

        /// <summary>
        /// Serializes properties of a certain component.
        /// </summary>
        /// <param name="componentHolder">The parent expression that holds the instance.</param>
        /// <param name="instance">The component to take away the values from.</param>
        /// <returns>A collection of code statements initiating the properties of the given object to their values.</returns>
        public CodeStatementCollection SerializeProperties(CodeExpression componentHolder, object instance)
        {
            CodeStatementCollection statements = new CodeStatementCollection();

            // Iterate through properties and add property + value to statements.
            foreach (PropertyDescriptor property in GetMustSerializeProperties(instance))
            {
                statements.AddRange(SerializeProperty(componentHolder, instance, property));
            }

            return statements;
        }
开发者ID:die-Deutsche-Orthopaedie,项目名称:LiteDevelop,代码行数:18,代码来源:CodeDomPropertySerializer.cs

示例11: GenerateCodeInvocation

        public CodeStatementCollection GenerateCodeInvocation(CallProcessActivity callProcessActivity)
        {
            var invocationCodeCollection = new CodeStatementCollection();
            // Add the Log
            invocationCodeCollection.AddRange(DefaultActivityBuilder.LogActivity(callProcessActivity));
            // Add the mapping
            invocationCodeCollection.AddRange(this.xslBuilder.Build(callProcessActivity.InputBindings));

            // Add the invocation
            var processToCallReference = new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), VariableHelper.ToVariableName(callProcessActivity.TibcoProcessToCall.ProcessName));

            var parameters = DefaultActivityBuilder.GenerateParameters(callProcessActivity);

            // TODO : WARNING not sure the start method ProcessName is indeed START
            var methodInvocation = new CodeMethodInvokeExpression(processToCallReference, "Start", parameters);

            var code = new CodeVariableDeclarationStatement("var", VariableHelper.ToVariableName(callProcessActivity.Name), methodInvocation);

            invocationCodeCollection.Add(code);

            return invocationCodeCollection;
        }
开发者ID:swoog,项目名称:EaiConverter,代码行数:22,代码来源:CallProcessActivityBuilder.cs

示例12: CodeSwitchStatement

        public CodeSwitchStatement(CodeExpression target, CodeSwitchOption[] options, params CodeStatement[] defaultStatements)
        {
            _target = target;
            _options = new CodeSwitchOptionCollection(OptionsChanged, options);

            foreach (CodeSwitchOption option in options)
            {
                option.SetTarget(_target);
            }

            _defaultStatements = base.FalseStatements;
            _defaultStatements.AddRange(defaultStatements);
            Refresh();
        }
开发者ID:Saleslogix,项目名称:SLXMigration,代码行数:14,代码来源:CodeSwitchStatement.cs

示例13: SerializeProperty

        /// <summary>
        /// Serializes a specific property to code.
        /// </summary>
        /// <param name="instanceHolder">The parent expression that holds the instance.</param>
        /// <param name="instance">The instance to take away the values from.</param>
        /// <param name="property">The property to serialize.</param>
        /// <returns>A collection of code statements initiating the given property of the given object to its value.</returns>
        public CodeStatementCollection SerializeProperty(CodeExpression instanceHolder, object instance, PropertyDescriptor property)
        {
            CodeStatementCollection statements = new CodeStatementCollection();

            var propertyExpression = new CodePropertyReferenceExpression(
                    instanceHolder,
                    property.Name);

            object propertyValue = property.GetValue(instance);
            if (property.PropertyType.HasInterface(typeof(ICollection)))
            {
                // If collection, create property.Add(...) statements.
                statements.AddRange(CreateCollectionInitialization(propertyExpression, instance, property));
            }
            else if (CodeDomTypeFormatter.IsFormattableWithAssignment(property.PropertyType)) 
            {
                // else, create normal property = value statement.
                statements.Add(CreatePropertyAssignmentExpression(propertyExpression, instance, property));
            }

            if (!CodeDomTypeFormatter.IsFormattableWithAssignment(property.PropertyType))
            {
                // serialize child properties.
                if (property.PropertyType.IsValueType)
                {
                    // value types uses a temp var.to access properties.
                    statements.AddRange(CreateValueTypeInitialization(propertyExpression, instance, property));
                }
                else
                {
                    // access properties directly.
                    statements.AddRange(SerializeProperties(propertyExpression, propertyValue));
                }
            }

            return statements;
        }
开发者ID:die-Deutsche-Orthopaedie,项目名称:LiteDevelop,代码行数:44,代码来源:CodeDomPropertySerializer.cs

示例14: InvocationMethod

        private CodeStatementCollection InvocationMethod(Activity activity)
        {
            var invocationCodeCollection = new CodeStatementCollection();
            invocationCodeCollection.AddRange(DefaultActivityBuilder.LogActivity(activity));

            var groupActivity = (GroupActivity)activity;

            if (groupActivity.GroupType == GroupType.simpleGroup)
            {
                invocationCodeCollection.AddRange(this.GenerateCoreGroupMethod(groupActivity));
            }
            else
            {
                var forLoop = this.GenerateForLoop(groupActivity);
                invocationCodeCollection.Add(forLoop);
            }

            return invocationCodeCollection;
        }
开发者ID:swoog,项目名称:EaiConverter,代码行数:19,代码来源:GroupActivityBuilder.cs

示例15: GenerateForLoop

        private CodeIterationStatement GenerateForLoop(GroupActivity groupActivity)
        {
            var coreGroupMethodStatement = new CodeStatementCollection();

            // put the current element in the declare variable
            // TODO convert the $Variable in variable like in Xpath
            CodeVariableDeclarationStatement iterationElementSlotDeclaration = new CodeVariableDeclarationStatement("var", groupActivity.IterationElementSlot, new CodeVariableReferenceExpression(groupActivity.Over + "[" + groupActivity.IndexSlot + "]"));
            coreGroupMethodStatement.Add(iterationElementSlotDeclaration);
            // get the core loop code
            coreGroupMethodStatement.AddRange(this.GenerateCoreGroupMethod(groupActivity));
            var array = new CodeStatement[coreGroupMethodStatement.Count];
            coreGroupMethodStatement.CopyTo(array, 0);

            // put it then in the loop
            CodeIterationStatement forLoop = new CodeIterationStatement(new CodeVariableDeclarationStatement(typeof(int), groupActivity.IndexSlot, new CodePrimitiveExpression(0)),
                new CodeBinaryOperatorExpression(new CodeVariableReferenceExpression(groupActivity.IndexSlot), CodeBinaryOperatorType.LessThan, new CodeVariableReferenceExpression(groupActivity.Over + ".Lenght")),
                new CodeAssignStatement(new CodeVariableReferenceExpression(groupActivity.IndexSlot), new CodeBinaryOperatorExpression(new CodeVariableReferenceExpression(groupActivity.IndexSlot), CodeBinaryOperatorType.Add, new CodePrimitiveExpression(1))),
                array);
            return forLoop;
        }
开发者ID:swoog,项目名称:EaiConverter,代码行数:20,代码来源:GroupActivityBuilder.cs


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