Interface INamespace
Represents a namespace declared in an application assembly, or declared in a third-party assembly and used by the application code.
public interface INamespace : ICodeElementParent, ICodeContainer, IUser, ICodeElement, IUsed
- Inherited Members
- Extension Methods
Remarks
If N assemblies declare the same namespace, there are NINamespace objects with a common Name value, one object for each assembly that declares the namespace.
Properties (14)
ContainsTypeDependencyCycle
Gets a value indicating whether this namespace contains a dependency cycle between its ChildTypes. Gets null if this namespace is declared in a third-party assembly.
bool? ContainsTypeDependencyCycle { get; }
Property Value
- bool?
Remarks
The result of this property getter is lazy computed.
The first time it is called it has a O(this.ChildTypes.Count ^2) time complexity.
Further calls result in a constant time complexity.
CouldBeInternal
Gets a value indicating whether this namespace has at least one child public type, but is not used by any namespace declared in another assembly.
bool CouldBeInternal { get; }
Property Value
Remarks
A public code element can be declared as internal if it is not used outside of the assembly it is declared in.
When analyzing a framework, many of public members will be considered as CouldBeInternal because there is no analyzed client code using them.
DirectChildNamespaces
Gets a sequence of direct child namespaces of this namespace. For example child namespaces of the namespace AA.BB could be AA.BB.CC but not AA.BB.CC.DD.
IEnumerable<INamespace> DirectChildNamespaces { get; }
Property Value
Remarks
The anonymous namespace doesn't have any direct child namespace.
This property getter has a O(this.ParentAssembly.ChildNamespaces.Count) time complexity.
- See Also
IsGeneratedByCompiler
Gets a value indicating whether this namespace contains only types generated by the compiler.
bool IsGeneratedByCompiler { get; }
Property Value
Remarks
Such namespace can be named for example Microsoft.CodeAnalysis or System.Runtime.CompilerServices.
IsInternal
Gets a value indicating whether this namespace contains only internal types.
bool IsInternal { get; }
Property Value
IsPublic
Gets a value indicating whether this namespace contains at least one public type.
bool IsPublic { get; }
Property Value
NamespacesUsed
Gets a sequence of namespaces that this namespace is using. If this namespace is declared in a third-party assembly, gets an empty sequence.
IEnumerable<INamespace> NamespacesUsed { get; }
Property Value
Remarks
This property getter has a O(this.NamespacesUsed.Count) time complexity.
- See Also
NamespacesUsingMe
Gets a sequence of namespaces that are using this namespace.
IEnumerable<INamespace> NamespacesUsingMe { get; }
Property Value
Remarks
This property getter has a O(this.NamespacesUsingMe.Count) time complexity.
- See Also
NbNamespacesUsed
Gets the number of namespaces this namespace is using. Gets null if this namespace is declared in a third-party assembly.
uint? NbNamespacesUsed { get; }
Property Value
- uint?
NbNamespacesUsingMe
Gets the number of namespaces that use this namespace.
uint NbNamespacesUsingMe { get; }
Property Value
NbTypes
Gets the number of types declared in this namespace. Gets null if this namespace is declared in a third-party assembly.
uint? NbTypes { get; }
Property Value
- uint?
ParentAssembly
Gets the parent assembly of this namespace.
IAssembly ParentAssembly { get; }
Property Value
Remarks
This property getter has a constant time complexity.
ParentNamespace
Gets the parent namespaces of this namespace. Gets null if no parent namespace is found. For example the parent namespace of the namespace AA.BB.CC could be AA.BB but not AA.
INamespace ParentNamespace { get; }
Property Value
Remarks
The anonymous namespace doesn't have any parent namespace.
If the namespace AA.BB doesn't contain any type, it is not shown as a parent namespace of AA.BB.CC. Indeed, if a namespace doesn't contain any type, the NDepend code model doesn't contain an associated INamespace object. In such case AA is deemed as being the direct parent namespace of AA.BB.CC.
This property getter has a O(this.ParentAssembly.ChildNamespaces.Count) time complexity.
- See Also
ParentNamespaces
Gets a sequence of parent namespaces of this namespace. For example parent namespaces of the namespace AA.BB.CC could be AA.BB and AA.
IEnumerable<INamespace> ParentNamespaces { get; }
Property Value
Remarks
The anonymous namespace doesn't have any parent namespace.
If the namespace AA.BB doesn't contain any type, it is not shown as a parent namespace of AA.BB.CC. Indeed, if a namespace doesn't contain any type, the NDepend code model doesn't contain an associated INamespace object.
This property getter has a O(this.ParentAssembly.ChildNamespaces.Count) time complexity.
- See Also