CodeNamespace.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. //
  2. // System.CodeDom CodeNamespace 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 CodeNamespace
  17. : CodeObject
  18. {
  19. private CodeCommentStatementCollection comments;
  20. private CodeNamespaceImportCollection imports;
  21. private CodeTypeDeclarationCollection types;
  22. private string name;
  23. //
  24. // Constructors
  25. //
  26. public CodeNamespace()
  27. {
  28. }
  29. public CodeNamespace(string name)
  30. {
  31. this.name = name;
  32. }
  33. //
  34. // Properties
  35. //
  36. public CodeCommentStatementCollection Comments {
  37. get {
  38. if ( comments == null ) {
  39. comments = new CodeCommentStatementCollection();
  40. if ( PopulateComments != null )
  41. PopulateComments( this, EventArgs.Empty );
  42. }
  43. return comments;
  44. }
  45. }
  46. public CodeNamespaceImportCollection Imports {
  47. get {
  48. if ( imports == null ) {
  49. imports = new CodeNamespaceImportCollection();
  50. if ( PopulateImports != null )
  51. PopulateImports( this, EventArgs.Empty );
  52. }
  53. return imports;
  54. }
  55. }
  56. public string Name {
  57. get {
  58. return name;
  59. }
  60. set {
  61. name = value;
  62. }
  63. }
  64. public CodeTypeDeclarationCollection Types {
  65. get {
  66. if ( types == null ) {
  67. types = new CodeTypeDeclarationCollection();
  68. if ( PopulateTypes != null )
  69. PopulateTypes( this, EventArgs.Empty );
  70. }
  71. return types;
  72. }
  73. }
  74. //
  75. // Events
  76. //
  77. public event EventHandler PopulateComments;
  78. public event EventHandler PopulateImports;
  79. public event EventHandler PopulateTypes;
  80. }
  81. }