Open sandboxFocus

Method GetNamespace

GetNamespace(IDeclaration)

Gets the namespace of a given declaration, i.e. the namespace itself if the given declaration is a namespace, the closest containing namespace, or the global namespace if an ICompilation is given.

Declaration
public static INamespace? GetNamespace(this IDeclaration declaration)
Parameters
Type Name Description
IDeclaration declaration

The declaration.

Returns
Type Description
INamespace

The namespace, or null if none is found.