Initial commit
[mono.git] / mcs / class / referencesource / System / compmod / system / codedom / CodeParameterDeclarationExpression.cs
1 //------------------------------------------------------------------------------
2 // <copyright file="CodeParameterDeclarationExpression.cs" company="Microsoft">
3 // 
4 // <OWNER>[....]</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 parameter declaration for method, constructor, or property arguments.
20     ///    </para>
21     /// </devdoc>
22     [
23         ClassInterface(ClassInterfaceType.AutoDispatch),
24         ComVisible(true),
25         Serializable,
26     ]
27     public class CodeParameterDeclarationExpression : CodeExpression {
28         private CodeTypeReference type;
29         private string name;
30         private CodeAttributeDeclarationCollection customAttributes = null;
31         private FieldDirection dir = FieldDirection.In;
32
33
34         /// <devdoc>
35         ///    <para>
36         ///       Initializes a new instance of <see cref='System.CodeDom.CodeParameterDeclarationExpression'/>.
37         ///    </para>
38         /// </devdoc>
39         public CodeParameterDeclarationExpression() {
40         }
41
42         /// <devdoc>
43         ///    <para>
44         ///       Initializes a new instance of <see cref='System.CodeDom.CodeParameterDeclarationExpression'/> using the specified type and name.
45         ///    </para>
46         /// </devdoc>
47         public CodeParameterDeclarationExpression(CodeTypeReference type, string name) {
48             Type = type;
49             Name = name;
50         }
51
52         /// <devdoc>
53         ///    <para>[To be supplied.]</para>
54         /// </devdoc>
55         public CodeParameterDeclarationExpression(string type, string name) {
56             Type = new CodeTypeReference(type);
57             Name = name;
58         }
59
60         /// <devdoc>
61         ///    <para>[To be supplied.]</para>
62         /// </devdoc>
63         public CodeParameterDeclarationExpression(Type type, string name) {
64             Type = new CodeTypeReference(type);
65             Name = name;
66         }
67
68         /// <devdoc>
69         ///    <para>
70         ///       Gets or sets the custom attributes for the parameter declaration.
71         ///    </para>
72         /// </devdoc>
73         public CodeAttributeDeclarationCollection CustomAttributes {
74             get {
75                 if (customAttributes == null) {
76                     customAttributes = new CodeAttributeDeclarationCollection();
77                 }
78                 return customAttributes;
79             }
80             set {
81                 customAttributes = value;
82             }
83         }
84
85         /// <devdoc>
86         ///    <para>
87         ///       Gets or sets
88         ///       the direction of the field.
89         ///    </para>
90         /// </devdoc>
91         public FieldDirection Direction {
92             get {
93                 return dir;
94             }
95             set {
96                 dir = value;
97             }
98         }
99
100         /// <devdoc>
101         ///    <para>
102         ///       Gets or sets
103         ///       the type of the parameter.
104         ///    </para>
105         /// </devdoc>
106         public CodeTypeReference Type {
107             get {
108                 if (type == null) {
109                     type = new CodeTypeReference("");
110                 }
111                 return type;
112             }
113             set {
114                 type = value;
115             }
116         }
117
118         /// <devdoc>
119         ///    <para>
120         ///       Gets or sets
121         ///       the name of the parameter.
122         ///    </para>
123         /// </devdoc>
124         public string Name {
125             get {
126                 return (name == null) ? string.Empty : name;
127             }
128             set {
129                 name = value;
130             }
131         }
132     }
133 }