System.CodeDom.CodeNamespace Class

Assembly: System.dll
Namespace: System.CodeDom
Summary
Represents a namespace declaration.
C# Syntax:
[Serializable]
public class CodeNamespace : CodeObject
Remarks
CodeNamespace can be used to represent a namespace declaration.

In some languages, a namespace can function as a container of type declarations within the same namespace, in which all types within the same namespace are visible.



Note Use fully qualified type references to avoid potential ambiguity.
See also:
System.CodeDom Namespace

System.CodeDom.CodeNamespace Member List:

Public Constructors
ctor #1 Overloaded:
.ctor()

Default constructor. This constructor is called by derived class constructors to initialize state in this type.
Initializes a new instance of the CodeNamespace class.
ctor #2 Overloaded:
.ctor(string name)

Initializes a new instance of the CodeNamespace class using the specified name.
Public Properties
Comments Read-only

Gets or sets the member comment collection members.
Imports Read-only

Gets or sets the collection of namespace import directives used by the represented namespace.
Name Read-write

Gets or sets the name of the namespace.
Types Read-only

Gets the collection of types that the represented namespace contains.
UserData
(inherited from System.CodeDom.CodeObject)
Read-only

See base class member description: System.CodeDom.CodeObject.UserData


Gets or sets the user-definable data for the current object.
Public Methods
Equals
(inherited from System.Object)
See base class member description: System.Object.Equals

Derived from System.Object, the primary base class for all objects.
GetHashCode
(inherited from System.Object)
See base class member description: System.Object.GetHashCode

Derived from System.Object, the primary base class for all objects.
GetType
(inherited from System.Object)
See base class member description: System.Object.GetType

Derived from System.Object, the primary base class for all objects.
ToString
(inherited from System.Object)
See base class member description: System.Object.ToString

Derived from System.Object, the primary base class for all objects.
Public Events
PopulateComments An event that will be raised the first time the CodeNamespace.Comments collection is accessed.
PopulateImports An event that will be raised the first time the CodeNamespace.Imports collection is accessed.
PopulateTypes An event that will be raised the first time the CodeNamespace.Types collection is accessed.
Protected Methods
Finalize
(inherited from System.Object)
See base class member description: System.Object.Finalize

Derived from System.Object, the primary base class for all objects.
MemberwiseClone
(inherited from System.Object)
See base class member description: System.Object.MemberwiseClone

Derived from System.Object, the primary base class for all objects.

Hierarchy:


System.CodeDom.CodeNamespace Member Details

Overloaded ctor #1
Summary
Initializes a new instance of the CodeNamespace class.

Default constructor. This constructor is called by derived class constructors to initialize state in this type.
C# Syntax:
public CodeNamespace();

Return to top


Overloaded ctor #2
Summary
Initializes a new instance of the CodeNamespace class using the specified name.
C# Syntax:
public CodeNamespace(
   string name
);
Parameters:

name

The name of the namespace being declared.

Return to top


Property: Comments (read-only)
Summary
Gets or sets the member comment collection members.
C# Syntax:
public CodeCommentStatementCollection Comments {get;}
See also:
CodeCommentStatementCollection

Return to top


Property: Imports (read-only)
Summary
Gets or sets the collection of namespace import directives used by the represented namespace.
C# Syntax:
public CodeNamespaceImportCollection Imports {get;}
See also:
CodeNamespaceImportCollection

Return to top


Property: Name (read-write)
Summary
Gets or sets the name of the namespace.
C# Syntax:
public string Name {get; set;}

Return to top


Property: Types (read-only)
Summary
Gets the collection of types that the represented namespace contains.
C# Syntax:
public CodeTypeDeclarationCollection Types {get;}
See also:
CodeTypeDeclarationCollection

Return to top


Property: UserData (read-only)
Inherited
See base class member description: System.CodeDom.CodeObject.UserData

Summary
Gets or sets the user-definable data for the current object.
C# Syntax:
public IDictionary UserData {get;}
Remarks


Notes to inheritors: An inheritor can design the way this user data is stored, retrieved, and used.

Return to top


Method: Equals(
   object obj
)
Inherited
See base class member description: System.Object.Equals
C# Syntax:
public virtual bool Equals(
   object obj
);

For more information on members inherited from System.Object click on the link above.

Return to top


Method: Finalize()
Inherited
See base class member description: System.Object.Finalize
C# Syntax:
~CodeNamespace();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: GetHashCode()
Inherited
See base class member description: System.Object.GetHashCode
C# Syntax:
public virtual int GetHashCode();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: GetType()
Inherited
See base class member description: System.Object.GetType
C# Syntax:
public Type GetType();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: MemberwiseClone()
Inherited
See base class member description: System.Object.MemberwiseClone
C# Syntax:
protected object MemberwiseClone();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: ToString()
Inherited
See base class member description: System.Object.ToString
C# Syntax:
public virtual string ToString();

For more information on members inherited from System.Object click on the link above.

Return to top


Event: PopulateComments
Summary
An event that will be raised the first time the CodeNamespace.Comments collection is accessed.
C# Syntax:
public event EventHandler PopulateComments;

Return to top


Event: PopulateImports
Summary
An event that will be raised the first time the CodeNamespace.Imports collection is accessed.
C# Syntax:
public event EventHandler PopulateImports;

Return to top


Event: PopulateTypes
Summary
An event that will be raised the first time the CodeNamespace.Types collection is accessed.
C# Syntax:
public event EventHandler PopulateTypes;

Return to top


Top of page

Copyright (c) 2002 Microsoft Corporation. All rights reserved.