The Labs \ Source Viewer \ SSCLI \ System.CodeDom \ CodeConditionStatement

  1. //------------------------------------------------------------------------------
  2. // <copyright file="CodeConditionStatement.cs" company="Microsoft">
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. // </copyright>
  14. //------------------------------------------------------------------------------
  15. namespace System.CodeDom
  16. {
  17.    
  18.     using System.Diagnostics;
  19.     using System;
  20.     using Microsoft.Win32;
  21.     using System.Collections;
  22.     using System.Runtime.InteropServices;
  23.    
  24.     /// <devdoc>
  25.     /// <para>
  26.     /// Represents a basic if statement.
  27.     /// </para>
  28.     /// </devdoc>
  29.     [ClassInterface(ClassInterfaceType.AutoDispatch), ComVisible(true), Serializable()]
  30.     public class CodeConditionStatement : CodeStatement
  31.     {
  32.         private CodeExpression condition;
  33.         private CodeStatementCollection trueStatments = new CodeStatementCollection();
  34.         private CodeStatementCollection falseStatments = new CodeStatementCollection();
  35.        
  36.         /// <devdoc>
  37.         /// <para>
  38.         /// Initializes a new instance of <see cref='System.CodeDom.CodeConditionStatement'/>.
  39.         /// </para>
  40.         /// </devdoc>
  41.         public CodeConditionStatement()
  42.         {
  43.         }
  44.        
  45.         /// <devdoc>
  46.         /// <para>
  47.         /// Initializes a new instance of <see cref='System.CodeDom.CodeConditionStatement'/>.
  48.         /// </para>
  49.         /// </devdoc>
  50.         public CodeConditionStatement(CodeExpression condition, params CodeStatement[] trueStatements)
  51.         {
  52.             Condition = condition;
  53.             TrueStatements.AddRange(trueStatements);
  54.         }
  55.        
  56.         /// <devdoc>
  57.         /// <para>
  58.         /// Initializes a new instance of <see cref='System.CodeDom.CodeConditionStatement'/> that can represent an if..
  59.         /// else statement.
  60.         /// </para>
  61.         /// </devdoc>
  62.         public CodeConditionStatement(CodeExpression condition, CodeStatement[] trueStatements, CodeStatement[] falseStatements)
  63.         {
  64.             Condition = condition;
  65.             TrueStatements.AddRange(trueStatements);
  66.             FalseStatements.AddRange(falseStatements);
  67.         }
  68.        
  69.         /// <devdoc>
  70.         /// <para>
  71.         /// Gets or sets
  72.         /// the condition to test for <see langword='true'/>.
  73.         /// </para>
  74.         /// </devdoc>
  75.         public CodeExpression Condition {
  76.             get { return condition; }
  77.             set { condition = value; }
  78.         }
  79.        
  80.         /// <devdoc>
  81.         /// <para>
  82.         /// Gets or sets
  83.         /// the statements to execute if test condition is <see langword='true'/>.
  84.         /// </para>
  85.         /// </devdoc>
  86.         public CodeStatementCollection TrueStatements {
  87.             get { return trueStatments; }
  88.         }
  89.        
  90.         /// <devdoc>
  91.         /// <para>
  92.         /// Gets or sets
  93.         /// the statements to
  94.         /// execute if test condition is <see langword='false'/> and there is an else
  95.         /// clause.
  96.         /// </para>
  97.         /// </devdoc>
  98.         public CodeStatementCollection FalseStatements {
  99.             get { return falseStatments; }
  100.         }
  101.     }
  102. }

Developer Fusion