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


C# CodeDom.CodeStatementCollection类代码示例

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


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

示例1: BuildDetectChangedMembers

        public static CodeStatementCollection BuildDetectChangedMembers(TableViewTableTypeBase table)
        {
            CodeStatementCollection ValidationSetStatement = new CodeStatementCollection();
            String PocoTypeName = "this";
            ValidationSetStatement.Add(new CodeSnippetExpression("Boolean bResult = new Boolean()"));
            ValidationSetStatement.Add(new CodeSnippetExpression("bResult = false"));

            foreach (Column c in table.Columns)
            {
                MemberGraph mGraph = new MemberGraph(c);
                CodeConditionStatement csTest1 = new CodeConditionStatement();

                if (mGraph.IsNullable)
                {
                    csTest1.Condition = new CodeSnippetExpression(PocoTypeName + "." + mGraph.PropertyName() + ".HasValue == true");
                    csTest1.TrueStatements.Add(new CodeSnippetExpression("bResult = true"));
                }
                else
                {
                    csTest1.Condition = new CodeSnippetExpression(PocoTypeName + "." + mGraph.PropertyName() + " == null");
                    csTest1.TrueStatements.Add(new CodeSnippetExpression(""));
                    csTest1.FalseStatements.Add(new CodeSnippetExpression("bResult = true"));
                }
            }

            return ValidationSetStatement;
        }
开发者ID:rexwhitten,项目名称:MGenerator,代码行数:27,代码来源:GraphAttributeSet.cs

示例2: 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

示例3: Serialize

		public virtual object Serialize (IDesignerSerializationManager manager, object value)
		{
			if (value == null)
				throw new ArgumentNullException ("value");
			if (manager == null)
				throw new ArgumentNullException ("manager");

			object serialized = null;
			bool isComplete = false;
			CodeExpression createExpr = base.SerializeCreationExpression (manager, value, out isComplete);
			if (isComplete) {
				serialized = createExpr;
				base.SetExpression (manager, value, createExpr);
			} else {
				ExpressionContext context = manager.Context[typeof (ExpressionContext)] as ExpressionContext;
				if (context != null && context.PresetValue == value) {
					CodeStatementCollection statements = new CodeStatementCollection ();
					statements.Add (new CodeAssignStatement (context.Expression, createExpr));
					base.SerializeProperties (manager, statements, value, new Attribute[0]);
					base.SerializeEvents (manager, statements, value, new Attribute[0]);
				} else {
					CodeExpression expression = base.GetExpression (manager, value);
					if (expression == null) {
						serialized = expression = createExpr;
						base.SetExpression (manager, value, expression);
					}
				}
			}
			return serialized;
		}
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:30,代码来源:CodeDomSerializer.cs

示例4: ToCodeDom

 public override void ToCodeDom(CodeStatementCollection statements)
 {
     if (this.expression!=null)
         statements.Add(new CodeExpressionStatement(this.expression.ToCodeDom()));
     else
         statements.Add(new CodeStatement());
 }
开发者ID:spib,项目名称:nhcontrib,代码行数:7,代码来源:ExpressionStatement.cs

示例5: AddRange

	public void AddRange(CodeStatementCollection value)
			{
				foreach(CodeStatement e in value)
				{
					List.Add(e);
				}
			}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:7,代码来源:CodeStatementCollection.cs

示例6: FillJSONArrayMembers

        private void FillJSONArrayMembers(CodeStatementCollection statements)
        {
            if (IsComplexType())
            {
                statements.Add(
                    new CodeVariableDeclarationStatement(new CodeTypeReference("Org.Json.JSONObject"), "jsonObject", new CodeObjectCreateExpression("Org.Json.JSONObject")));

                statements.Add(
                    new CodeMethodInvokeExpression(null, "AddToJsonArray", new CodeVariableReferenceExpression("jsonArray"), new CodeVariableReferenceExpression("jsonObject")));

                statements.Add(
                    new CodeMethodInvokeExpression(null, methodName, new CodeVariableReferenceExpression("objs[i]"), new CodeVariableReferenceExpression("jsonObject")));

            }
            else
            {
                if (IsEnum())
                {
                    statements.Add(
                        new CodeMethodInvokeExpression(null, "AddToJsonArray", new CodeVariableReferenceExpression("jsonArray"), new CodeCastExpression(type.Fields[0].FieldType.FullName, new CodeVariableReferenceExpression("objs[i]"))));
                }
                else
                {
                    statements.Add(
                        new CodeMethodInvokeExpression(null, "AddToJsonArray", new CodeVariableReferenceExpression("jsonArray"), new CodeVariableReferenceExpression("objs[i]")));
                }
            }
        }
开发者ID:Xtremrules,项目名称:dot42,代码行数:28,代码来源:TypeSerializerBuilder.cs

示例7: BuildOperation

 public override CodeStatementCollection BuildOperation(CodeGenerationContext ctx, ICodeGeneratorNode element, CodeVariableReferenceExpression value)
 {
     CodeStatementCollection statemets = new CodeStatementCollection();
     statemets.Add(new CodeSnippetExpression(
         string.Format("{0} = ({2})((int){0} >> {1})", value.VariableName, Value, GetValueType(element.MappedProperty).FullName)));
     return statemets;
 }
开发者ID:anddudek,项目名称:anjlab.fx,代码行数:7,代码来源:RightShift.cs

示例8: Serialize

		public override void Serialize (IDesignerSerializationManager manager, object value, MemberDescriptor descriptor, CodeStatementCollection statements)
		{
			if (statements == null)
				throw new ArgumentNullException ("statements");
			if (manager == null)
				throw new ArgumentNullException ("manager");
			if (value == null)
				throw new ArgumentNullException ("value");
			if (descriptor == null)
				throw new ArgumentNullException ("descriptor");

			IEventBindingService service = manager.GetService (typeof (IEventBindingService)) as IEventBindingService;
			if (service != null) {
				// In the propertygrid the events are represented by PropertyDescriptors and the value is a string
				// which contains the method name to bind to. The propertydescriptors are managed and created by the 
				// IEventBindingService
				// 
				EventDescriptor ev = (EventDescriptor) descriptor;
				string methodName = (string) service.GetEventProperty (ev).GetValue (value);
				CodeDelegateCreateExpression listener = new CodeDelegateCreateExpression (new CodeTypeReference (ev.EventType), _thisReference, methodName);
				CodeExpression targetObject = base.SerializeToExpression (manager, value);
				CodeEventReferenceExpression eventRef = new CodeEventReferenceExpression (targetObject, ev.Name);
				statements.Add (new CodeAttachEventStatement (eventRef, listener));
			}
		}
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:25,代码来源:EventCodeDomSerializer.cs

示例9: DefaultInvocationMethod

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

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

示例10: CreateConstructor

		protected override void CreateConstructor (CodeStatementCollection localVars,
							CodeStatementCollection trueStmt)
		{
			if (pageParser.ClientTarget != null) {
				CodeExpression prop;
				prop = new CodePropertyReferenceExpression (thisRef, "ClientTarget");
				CodeExpression ct = new CodePrimitiveExpression (pageParser.ClientTarget);
				if (localVars == null)
					localVars = new CodeStatementCollection ();
				localVars.Add (new CodeAssignStatement (prop, ct));
			}

#if NET_2_0
			if (pageParser.MasterPageFile != null) {
				CodeExpression prop;
				prop = new CodePropertyReferenceExpression (thisRef, "MasterPageFile");
				CodeExpression ct = new CodePrimitiveExpression (pageParser.MasterPageFile);
				if (localVars == null)
					localVars = new CodeStatementCollection ();
				localVars.Add (new CodeAssignStatement (prop, ct));
			}
#endif

			base.CreateConstructor (localVars, trueStmt);
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:25,代码来源:PageCompiler.cs

示例11: Serialize

		public override object Serialize (IDesignerSerializationManager manager, object value)
		{
			if (value == null)
				throw new ArgumentNullException ("value");
			if (manager == null)
				throw new ArgumentNullException ("manager");

			object serialized = null;
			string name = manager.GetName (value);

			ExpressionContext exprContext = manager.Context[typeof (ExpressionContext)] as ExpressionContext;
			if (exprContext != null && exprContext.PresetValue == value) {
				CodeStatementCollection statements = new CodeStatementCollection ();
				bool isComplete = true;

				statements.Add (new CodeCommentStatement (String.Empty));
				statements.Add (new CodeCommentStatement (name));
				statements.Add (new CodeCommentStatement (String.Empty));
				statements.Add (new CodeAssignStatement (GetFieldReference (manager, name), 
														 base.SerializeCreationExpression (manager, value, out isComplete)));
				base.SerializeProperties (manager, statements, value, new Attribute[0]);
				base.SerializeEvents (manager, statements, value);
				serialized = statements;
			} else {
				serialized = base.Serialize (manager, value);
			}

			return serialized;
		}
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:29,代码来源:ComponentCodeDomSerializer.cs

示例12: BuildControlSkins

 private void BuildControlSkins(CodeStatementCollection statements) {
     foreach (ControlSkinBuilderEntry entry in _controlSkinBuilderEntryList) {
         string skinID = entry.SkinID;
         ControlBuilder builder = entry.Builder;
         statements.Add(BuildControlSkinAssignmentStatement(builder, skinID));
     }
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:7,代码来源:PageThemeCodeDomTreeGenerator.cs

示例13: AddOwner

 private void AddOwner(object statementOwner, CodeStatementCollection statements)
 {
     if (this._table == null)
     {
         this._table = new List<TableEntry>();
     }
     else
     {
         for (int i = 0; i < this._table.Count; i++)
         {
             if (object.ReferenceEquals(this._table[i].Owner, statementOwner))
             {
                 if (this._table[i].Statements != null)
                 {
                     throw new InvalidOperationException();
                 }
                 if (statements != null)
                 {
                     this._table[i] = new TableEntry(statementOwner, statements);
                 }
                 return;
             }
         }
     }
     this._table.Add(new TableEntry(statementOwner, statements));
     this._version++;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:27,代码来源:ObjectStatementCollection.cs

示例14: ToCodeDom

        public override void ToCodeDom(CodeStatementCollection statements)
        {
            CodeStatement init = null;
            CodeStatement increment = null;

            if (this.initStatement!=null)
            {
                CodeStatementCollection col = new CodeStatementCollection();
                this.initStatement.ToCodeDom(col);
                init = col[0];
            }

            if (this.incrementStatement!=null)
            {
                CodeStatementCollection col = new CodeStatementCollection();
                this.incrementStatement.ToCodeDom(col);
                increment = col[0];
            }

            statements.Add(
                new CodeIterationStatement(
                    init,
                    this.testExpression.ToCodeDom(),
                    increment,
                    this.statements.ToCodeDomArray()
                    )
                );
        }
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:28,代码来源:IterationStatement.cs

示例15: Serialize

		public override void Serialize (IDesignerSerializationManager manager, object value, MemberDescriptor descriptor, 
						CodeStatementCollection statements)
		{
			if (statements == null)
				throw new ArgumentNullException ("statements");
			if (manager == null)
				throw new ArgumentNullException ("manager");
			if (value == null)
				throw new ArgumentNullException ("value");
			if (descriptor == null)
				throw new ArgumentNullException ("descriptor");

			IEventBindingService service = manager.GetService (typeof (IEventBindingService)) as IEventBindingService;
			if (service != null) {
				EventDescriptor eventDescriptor = (EventDescriptor) descriptor;
				string methodName = (string) service.GetEventProperty (eventDescriptor).GetValue (value);

				if (methodName != null) {
					CodeDelegateCreateExpression listener = new CodeDelegateCreateExpression (new CodeTypeReference (eventDescriptor.EventType),
																							   _thisReference, methodName);
					CodeExpression targetObject = base.SerializeToExpression (manager, value);
					CodeEventReferenceExpression eventRef = new CodeEventReferenceExpression (targetObject, eventDescriptor.Name);
					statements.Add (new CodeAttachEventStatement (eventRef, listener));
				}
			}
		}
开发者ID:Profit0004,项目名称:mono,代码行数:26,代码来源:EventCodeDomSerializer.cs


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