bcabe1bee86ff88987ada93b3d5dd5e6837a87bf
[mono.git] / mcs / class / referencesource / System / compmod / system / codedom / CodeIterationStatement.cs
1 //------------------------------------------------------------------------------
2 // <copyright file="CodeIterationStatement.cs" company="Microsoft">
3 // 
4 // <OWNER>Microsoft</OWNER>
5 //     Copyright (c) Microsoft Corporation.  All rights reserved.
6 // </copyright>                                                                
7 //------------------------------------------------------------------------------
8
9 namespace System.CodeDom {
10
11     using System.Diagnostics;
12     using System;
13     using Microsoft.Win32;
14     using System.Collections;
15     using System.Runtime.InteropServices;
16
17     /// <devdoc>
18     ///    <para>
19     ///       Represents a simple for loop.
20     ///    </para>
21     /// </devdoc>
22     [
23         ClassInterface(ClassInterfaceType.AutoDispatch),
24         ComVisible(true),
25         Serializable,
26     ]
27     public class CodeIterationStatement : CodeStatement {
28         private CodeStatement initStatement;
29         private CodeExpression testExpression;
30         private CodeStatement incrementStatement;
31         private CodeStatementCollection statements = new CodeStatementCollection();
32
33         /// <devdoc>
34         ///    <para>
35         ///       Initializes a new instance of <see cref='System.CodeDom.CodeIterationStatement'/>.
36         ///    </para>
37         /// </devdoc>
38         public CodeIterationStatement() {
39         }
40
41         /// <devdoc>
42         ///    <para>
43         ///       Initializes a new instance of <see cref='System.CodeDom.CodeIterationStatement'/>.
44         ///    </para>
45         /// </devdoc>
46         public CodeIterationStatement(CodeStatement initStatement, CodeExpression testExpression, CodeStatement incrementStatement, params CodeStatement[] statements) {
47             InitStatement = initStatement;
48             TestExpression = testExpression;
49             IncrementStatement = incrementStatement;
50             Statements.AddRange(statements);
51         }
52
53         /// <devdoc>
54         ///    <para>
55         ///       Gets or sets
56         ///       the loop initialization statement.
57         ///    </para>
58         /// </devdoc>
59         public CodeStatement InitStatement {
60             get {
61                 return initStatement;
62             }
63             set {
64                 initStatement = value;
65             }
66         }
67
68         /// <devdoc>
69         ///    <para>
70         ///       Gets or sets
71         ///       the expression to test for.
72         ///    </para>
73         /// </devdoc>
74         public CodeExpression TestExpression {
75             get {
76                 return testExpression;
77             }
78             set {
79                 testExpression = value;
80             }
81         }
82
83         /// <devdoc>
84         ///    <para>
85         ///       Gets or sets
86         ///       the per loop cycle increment statement.
87         ///    </para>
88         /// </devdoc>
89         public CodeStatement IncrementStatement {
90             get {
91                 return incrementStatement;
92             }
93             set {
94                 incrementStatement = value;
95             }
96         }
97
98         /// <devdoc>
99         ///    <para>
100         ///       Gets or sets
101         ///       the statements to be executed within the loop.
102         ///    </para>
103         /// </devdoc>
104         public CodeStatementCollection Statements {
105             get {
106                 return statements;
107             }
108         }        
109     }
110 }