CodeQL library for C#
codeql/csharp-all 1.0.1 (changelog, source)

Member predicate ValueOrRefType::getParentNamespaceDeclaration

Gets the source namespace declaration in which this type is declared, if any. This only holds for non-nested types.

In the following example, only the class C2 has a parent namespace declaration returned by getParentNamespaceDeclaration.

class C1 { ... }

namespace N {
  class C2 {
    class C3 { ... }
NamespaceDeclaration getParentNamespaceDeclaration()