CodeMemberProperty.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. //
  2. // System.CodeDom CodeMemberProperty Class implementation
  3. //
  4. // Author:
  5. // Miguel de Icaza ([email protected])
  6. // Daniel Stodden ([email protected])
  7. //
  8. // (C) 2001 Ximian, Inc.
  9. //
  10. using System.Runtime.InteropServices;
  11. namespace System.CodeDom
  12. {
  13. [Serializable]
  14. [ClassInterface(ClassInterfaceType.AutoDispatch)]
  15. [ComVisible(true)]
  16. public class CodeMemberProperty
  17. : CodeTypeMember
  18. {
  19. private CodeStatementCollection getStatements;
  20. private bool hasGet;
  21. private bool hasSet;
  22. private CodeTypeReferenceCollection implementationTypes;
  23. private CodeParameterDeclarationExpressionCollection parameters;
  24. private CodeTypeReference privateImplementationType;
  25. private CodeStatementCollection setStatements;
  26. private CodeTypeReference type;
  27. //
  28. // Constructors
  29. //
  30. public CodeMemberProperty ()
  31. {
  32. }
  33. //
  34. // Properties
  35. //
  36. public CodeStatementCollection GetStatements {
  37. get {
  38. if ( getStatements == null )
  39. getStatements = new CodeStatementCollection();
  40. return getStatements;
  41. }
  42. }
  43. public bool HasGet {
  44. get {
  45. return (hasGet || (getStatements != null && getStatements.Count > 0));
  46. }
  47. set {
  48. hasGet = value;
  49. if (!hasGet && getStatements != null)
  50. getStatements.Clear ();
  51. }
  52. }
  53. public bool HasSet {
  54. get {
  55. return (hasSet || (setStatements != null && setStatements.Count > 0));
  56. }
  57. set {
  58. hasSet = value;
  59. if (!hasSet && setStatements != null)
  60. setStatements.Clear ();
  61. }
  62. }
  63. public CodeTypeReferenceCollection ImplementationTypes {
  64. get {
  65. if ( implementationTypes == null )
  66. implementationTypes = new CodeTypeReferenceCollection();
  67. return implementationTypes;
  68. }
  69. }
  70. public CodeParameterDeclarationExpressionCollection Parameters {
  71. get {
  72. if ( parameters == null )
  73. parameters = new CodeParameterDeclarationExpressionCollection();
  74. return parameters;
  75. }
  76. }
  77. public CodeTypeReference PrivateImplementationType {
  78. get {
  79. return privateImplementationType;
  80. }
  81. set {
  82. privateImplementationType = value;
  83. }
  84. }
  85. public CodeStatementCollection SetStatements {
  86. get {
  87. if ( setStatements == null )
  88. setStatements = new CodeStatementCollection();
  89. return setStatements;
  90. }
  91. }
  92. public CodeTypeReference Type {
  93. get {
  94. return type;
  95. }
  96. set {
  97. type = value;
  98. }
  99. }
  100. }
  101. }