Updates referencesource to .NET 4.7
[mono.git] / mcs / class / referencesource / System / compmod / system / codedom / CodeArrayCreateExpression.cs
1 //------------------------------------------------------------------------------
2 // <copyright file="CodeArrayCreateExpression.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> Represents
19     ///       an expression that creates an array.</para>
20     /// </devdoc>
21     [
22         ClassInterface(ClassInterfaceType.AutoDispatch),
23         ComVisible(true),
24         Serializable,
25     ]
26     public class CodeArrayCreateExpression : CodeExpression {
27         private CodeTypeReference createType;
28         private CodeExpressionCollection initializers = new CodeExpressionCollection();
29         private CodeExpression sizeExpression;
30         private int size = 0;
31
32         /// <devdoc>
33         ///    <para>
34         ///       Initializes a new instance of <see cref='System.CodeDom.CodeArrayCreateExpression'/>.
35         ///    </para>
36         /// </devdoc>
37         public CodeArrayCreateExpression() {
38         }
39
40         /// <devdoc>
41         ///    <para>
42         ///       Initializes a new instance of <see cref='System.CodeDom.CodeArrayCreateExpression'/> with the specified
43         ///       array type and initializers.
44         ///    </para>
45         /// </devdoc>
46         public CodeArrayCreateExpression(CodeTypeReference createType, params CodeExpression[] initializers) {
47             this.createType = createType;
48             this.initializers.AddRange(initializers);
49         }
50
51         /// <devdoc>
52         ///    <para>[To be supplied.]</para>
53         /// </devdoc>
54         public CodeArrayCreateExpression(string createType, params CodeExpression[] initializers) {
55             this.createType = new CodeTypeReference(createType);
56             this.initializers.AddRange(initializers);
57         }
58
59         /// <devdoc>
60         ///    <para>[To be supplied.]</para>
61         /// </devdoc>
62         public CodeArrayCreateExpression(Type createType, params CodeExpression[] initializers) {
63             this.createType = new CodeTypeReference(createType);
64             this.initializers.AddRange(initializers);
65         }
66
67         /// <devdoc>
68         ///    <para>
69         ///       Initializes a new instance of <see cref='System.CodeDom.CodeArrayCreateExpression'/>. with the specified array
70         ///       type and size.
71         ///    </para>
72         /// </devdoc>
73         public CodeArrayCreateExpression(CodeTypeReference createType, int size) {
74             this.createType = createType;
75             this.size = size;
76         }
77
78         /// <devdoc>
79         ///    <para>[To be supplied.]</para>
80         /// </devdoc>
81         public CodeArrayCreateExpression(string createType, int size) {
82             this.createType = new CodeTypeReference(createType);
83             this.size = size;
84         }
85
86         /// <devdoc>
87         ///    <para>[To be supplied.]</para>
88         /// </devdoc>
89         public CodeArrayCreateExpression(Type createType, int size) {
90             this.createType = new CodeTypeReference(createType);
91             this.size = size;
92         }
93
94         /// <devdoc>
95         ///    <para>
96         ///       Initializes a new instance of <see cref='System.CodeDom.CodeArrayCreateExpression'/>. with the specified array
97         ///       type and size.
98         ///    </para>
99         /// </devdoc>
100         public CodeArrayCreateExpression(CodeTypeReference createType, CodeExpression size) {
101             this.createType = createType;
102             this.sizeExpression = size;
103         }
104
105         /// <devdoc>
106         ///    <para>[To be supplied.]</para>
107         /// </devdoc>
108         public CodeArrayCreateExpression(string createType, CodeExpression size) {
109             this.createType = new CodeTypeReference(createType);
110             this.sizeExpression = size;
111         }
112
113         /// <devdoc>
114         ///    <para>[To be supplied.]</para>
115         /// </devdoc>
116         public CodeArrayCreateExpression(Type createType, CodeExpression size) {
117             this.createType = new CodeTypeReference(createType);
118             this.sizeExpression = size;
119         }
120
121         /// <devdoc>
122         ///    <para>
123         ///       Gets or sets
124         ///       the type of the array to create.
125         ///    </para>
126         /// </devdoc>
127         public CodeTypeReference CreateType {
128             get {
129                 if (createType == null) {
130                     createType = new CodeTypeReference("");
131                 }
132                 return createType;
133             }
134             set {
135                 createType = value;
136             }
137         }
138
139         /// <devdoc>
140         ///    <para>
141         ///       Gets or sets
142         ///       the initializers to initialize the array with.
143         ///    </para>
144         /// </devdoc>
145         public CodeExpressionCollection Initializers {
146             get {
147                 return initializers;
148             }
149         }
150
151         /// <devdoc>
152         ///    <para>
153         ///       Gets or sets
154         ///       the size of the array.
155         ///    </para>
156         /// </devdoc>
157         public int Size {
158             get {
159                 return size;
160             }
161             set {
162                 size = value;
163             }
164         }
165
166         /// <devdoc>
167         ///    <para>Gets or sets the size of the array.</para>
168         /// </devdoc>
169         public CodeExpression SizeExpression {
170             get {
171                 return sizeExpression;
172             }
173             set {
174                 sizeExpression = value;
175             }
176         }
177     }
178 }