1 // Licensed to the .NET Foundation under one or more agreements.
2 // The .NET Foundation licenses this file to you under the MIT license.
3 // See the LICENSE file in the project root for more information.
4 
5 namespace System.CodeDom
6 {
7     [Serializable]
8     public class CodeMemberProperty : CodeTypeMember
9     {
10         private CodeTypeReference _type;
11         private bool _hasGet;
12         private bool _hasSet;
13         private CodeTypeReferenceCollection _implementationTypes = null;
14 
15         public CodeTypeReference PrivateImplementationType { get; set; }
16 
17         public CodeTypeReferenceCollection ImplementationTypes => _implementationTypes ?? (_implementationTypes = new CodeTypeReferenceCollection());
18 
19         public CodeTypeReference Type
20         {
21             get { return _type ?? (_type = new CodeTypeReference("")); }
22             set { _type = value; }
23         }
24 
25         public bool HasGet
26         {
27             get { return _hasGet || GetStatements.Count > 0; }
28             set
29             {
30                 _hasGet = value;
31                 if (!value)
32                 {
33                     GetStatements.Clear();
34                 }
35             }
36         }
37 
38         public bool HasSet
39         {
40             get { return _hasSet || SetStatements.Count > 0; }
41             set
42             {
43                 _hasSet = value;
44                 if (!value)
45                 {
46                     SetStatements.Clear();
47                 }
48             }
49         }
50 
51         public CodeStatementCollection GetStatements { get; } = new CodeStatementCollection();
52 
53         public CodeStatementCollection SetStatements { get; } = new CodeStatementCollection();
54 
55         public CodeParameterDeclarationExpressionCollection Parameters { get; } = new CodeParameterDeclarationExpressionCollection();
56     }
57 }
58