Update Reference Sources to .NET Framework 4.6.1
[mono.git] / mcs / class / referencesource / System / compmod / system / codedom / CodeTypeMember.cs
1 //------------------------------------------------------------------------------
2 // <copyright file="CodeTypeMember.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.Reflection;
16     using System.Runtime.InteropServices;
17     using System.Runtime.Serialization;    
18
19     /// <devdoc>
20     ///    <para>
21     ///       Represents a class member.
22     ///    </para>
23     /// </devdoc>
24     [
25         ClassInterface(ClassInterfaceType.AutoDispatch),
26         ComVisible(true),
27         Serializable,
28     ]
29     public class CodeTypeMember : CodeObject {
30         private MemberAttributes attributes = MemberAttributes.Private | MemberAttributes.Final;
31         private string name;
32         private CodeCommentStatementCollection comments = new CodeCommentStatementCollection();
33         private CodeAttributeDeclarationCollection customAttributes = null;
34         private CodeLinePragma linePragma;
35         
36         // Optionally Serializable
37         [OptionalField]
38         private CodeDirectiveCollection startDirectives = null;
39         [OptionalField]        
40         private CodeDirectiveCollection endDirectives = null;
41         
42
43         /// <devdoc>
44         ///    <para>
45         ///       Gets or sets
46         ///       the name of the member.
47         ///    </para>
48         /// </devdoc>
49         public string Name {
50             get {
51                 return (name == null) ? string.Empty : name;
52             }
53             set {
54                 name = value;
55             }
56         }
57
58         /// <devdoc>
59         ///    <para>
60         ///       Gets or sets a <see cref='System.CodeDom.MemberAttributes'/> indicating
61         ///       the attributes of the member.
62         ///    </para>
63         /// </devdoc>
64         public MemberAttributes Attributes {
65             get {
66                 return attributes;
67             }
68             set {
69                 attributes = value;
70             }
71         }
72
73         /// <devdoc>
74         ///    <para>
75         ///       Gets or sets a <see cref='System.CodeDom.CodeAttributeDeclarationCollection'/> indicating
76         ///       the custom attributes of the
77         ///       member.
78         ///    </para>
79         /// </devdoc>
80         public CodeAttributeDeclarationCollection CustomAttributes {
81             get {
82                 if (customAttributes == null) {
83                     customAttributes = new CodeAttributeDeclarationCollection();
84                 }
85                 return customAttributes;
86             }
87             set {
88                 customAttributes = value;
89             }
90         }
91
92         /// <devdoc>
93         ///    <para>
94         ///       The line the statement occurs on.
95         ///    </para>
96         /// </devdoc>
97         public CodeLinePragma LinePragma {
98             get {
99                 return linePragma;
100             }
101             set {
102                 linePragma = value;
103             }
104         }
105
106         /// <devdoc>
107         ///    <para>
108         ///       Gets or sets the member comment collection members.
109         ///    </para>
110         /// </devdoc>
111         public CodeCommentStatementCollection Comments {
112             get {
113                 return comments;
114             }
115         }
116         
117         public CodeDirectiveCollection StartDirectives {
118             get {
119                 if (startDirectives == null) {
120                     startDirectives = new CodeDirectiveCollection();
121                 }
122                 return startDirectives;                
123             }
124         }
125
126         public CodeDirectiveCollection EndDirectives {
127             get {
128                 if (endDirectives == null) {
129                     endDirectives = new CodeDirectiveCollection();
130                 }
131                 return endDirectives ;                
132             }
133         }        
134     }
135 }
136