CodeMemberMethod.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. //
  2. // System.CodeDom CodeMemberMethod 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 CodeMemberMethod
  17. : CodeTypeMember
  18. {
  19. private CodeTypeReferenceCollection implementationTypes;
  20. private CodeParameterDeclarationExpressionCollection parameters;
  21. private CodeTypeReference privateImplementationType;
  22. private CodeTypeReference returnType;
  23. private CodeStatementCollection statements;
  24. private CodeAttributeDeclarationCollection returnTypeCustomAttributes;
  25. //
  26. // Constructors
  27. //
  28. public CodeMemberMethod()
  29. {
  30. }
  31. //
  32. // Properties
  33. //
  34. public CodeTypeReferenceCollection ImplementationTypes {
  35. get {
  36. if ( implementationTypes == null ) {
  37. implementationTypes = new CodeTypeReferenceCollection();
  38. if ( PopulateImplementationTypes != null )
  39. PopulateImplementationTypes( this, EventArgs.Empty );
  40. }
  41. return implementationTypes;
  42. }
  43. }
  44. public CodeParameterDeclarationExpressionCollection Parameters {
  45. get {
  46. if ( parameters == null ) {
  47. parameters = new CodeParameterDeclarationExpressionCollection();
  48. if ( PopulateParameters != null )
  49. PopulateParameters( this, EventArgs.Empty );
  50. }
  51. return parameters;
  52. }
  53. }
  54. public CodeTypeReference PrivateImplementationType {
  55. get {
  56. return privateImplementationType;
  57. }
  58. set {
  59. privateImplementationType = value;
  60. }
  61. }
  62. public CodeTypeReference ReturnType {
  63. get {
  64. if ( returnType == null )
  65. return new CodeTypeReference( typeof(void) );
  66. return returnType;
  67. }
  68. set {
  69. returnType = value;
  70. }
  71. }
  72. public CodeStatementCollection Statements {
  73. get {
  74. if ( statements == null ) {
  75. statements = new CodeStatementCollection();
  76. if ( PopulateStatements != null )
  77. PopulateStatements( this, EventArgs.Empty );
  78. }
  79. return statements;
  80. }
  81. }
  82. public CodeAttributeDeclarationCollection ReturnTypeCustomAttributes {
  83. get {
  84. if ( returnTypeCustomAttributes == null )
  85. returnTypeCustomAttributes = new CodeAttributeDeclarationCollection();
  86. return returnTypeCustomAttributes;
  87. }
  88. }
  89. //
  90. // Events
  91. //
  92. public event EventHandler PopulateImplementationTypes;
  93. public event EventHandler PopulateParameters;
  94. public event EventHandler PopulateStatements;
  95. }
  96. }