CodeConditionStatement.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. //
  2. // System.CodeDom CodeConditionStatement Class implementation
  3. //
  4. // Author:
  5. // Daniel Stodden ([email protected])
  6. //
  7. // (C) 2002 Ximian, Inc.
  8. //
  9. using System.Runtime.InteropServices;
  10. namespace System.CodeDom
  11. {
  12. [Serializable]
  13. [ClassInterface(ClassInterfaceType.AutoDispatch)]
  14. [ComVisible(true)]
  15. public class CodeConditionStatement
  16. : CodeStatement
  17. {
  18. private CodeExpression condition;
  19. private CodeStatementCollection trueStatements;
  20. private CodeStatementCollection falseStatements;
  21. //
  22. // Constructors
  23. //
  24. public CodeConditionStatement()
  25. {
  26. }
  27. public CodeConditionStatement( CodeExpression condition,
  28. params CodeStatement[] trueStatements )
  29. {
  30. this.condition = condition;
  31. this.TrueStatements.AddRange( trueStatements );
  32. }
  33. public CodeConditionStatement( CodeExpression condition,
  34. CodeStatement[] trueStatements,
  35. CodeStatement[] falseStatements )
  36. {
  37. this.condition = condition;
  38. this.TrueStatements.AddRange( trueStatements );
  39. this.FalseStatements.AddRange( falseStatements );
  40. }
  41. //
  42. // Properties
  43. //
  44. public CodeExpression Condition {
  45. get {
  46. return condition;
  47. }
  48. set {
  49. condition = value;
  50. }
  51. }
  52. public CodeStatementCollection FalseStatements {
  53. get {
  54. if ( falseStatements == null )
  55. falseStatements =
  56. new CodeStatementCollection();
  57. return falseStatements;
  58. }
  59. }
  60. public CodeStatementCollection TrueStatements {
  61. get {
  62. if ( trueStatements == null )
  63. trueStatements =
  64. new CodeStatementCollection();
  65. return trueStatements;
  66. }
  67. }
  68. }
  69. }