Open sandboxFocus
  • TOC

Metalama Documentation

Getting started

Video tutorials

Conceptual documentation

Commented examples

API documentation

Aspect API

Metalama.​Framework.​Advising

Metalama.​Framework.​Aspects

Metalama.​Framework.​Code

Accessibility

Accessibility­Extensions

Async­Info

Attribute­Extensions

Code­Display­Context

Code­Display­Format

Compilation­Extensions

Constructor­Collection­Extensions

Constructor­Initializer­Kind

Conversion­Kind

Declaration­Enhancements<T>

Declaration­Extensions

Declaration­Kind

Declaration­Origin­Kind

Derived­Types­Options

Enumerable­Kind

Execution­Scope

Generic­Extensions

IAnnotation

IAnnotation<T>

IAspect­Declaration­Origin

IAssembly

IAssembly­Identity

IAttribute

IAttribute­Data

ICompilation

ICompilation­Element

IConstructor

IDeclaration

IDeclaration­Cache

IDeclaration­Factory

IDeclaration­Origin

IDisplayable

IEvent

IExpression

IField

IField­Or­Property

IField­Or­Property­Or­Indexer

IGeneric

IGeneric­Context

IHas­Accessors

IHas­Parameters

IHas­Type

IIndexer

IManaged­Resource

IMember

IMember­Or­Named­Type

IMethod

IMethod­Base

INamed­Declaration

INamed­Type

INamespace

INamespace­Or­Named­Type

IObject­Creation­Expression

IParameter

IProperty

IProperty­Or­Indexer

IRef

IRef<T>

ISource­Expression

Iterator­Info

IType

IType­Parameter

Member­Extensions

Method­Collection­Extensions

Method­Extensions

Method­Kind

Named­Type­Extensions

Namespace­Extensions

Operator­Category

Operator­Kind

Operator­Kind­Extensions

Ref­Comparison

Ref­Extensions

Ref­Kind

Ref­Kind­Extensions

Reflection­Extensions

Serializable­Declaration­Id

Serializable­Type­Id

Source­Reference

Source­Span

Special­Type

Typed­Constant

Type­Extensions

Type­Factory

Type­Kind

Type­Kind­Constraint

Type­Parameter­Kind

Variance­Kind

Writeability

Metalama.​Framework.​Code.​Collections

Metalama.​Framework.​Code.​Comparers

Metalama.​Framework.​Code.​Declaration­Builders

Metalama.​Framework.​Code.​Invokers

Metalama.​Framework.​Code.​Syntax­Builders

Metalama.​Framework.​Code.​Types

Metalama.​Framework.​Code­Fixes

Metalama.​Framework.​Diagnostics

Metalama.​Framework.​Eligibility

Metalama.​Framework.​Fabrics

Metalama.​Framework.​Metrics

Metalama.​Framework.​Options

Metalama.​Framework.​Project

Metalama.​Framework.​Run­Time

Metalama.​Framework.​Serialization

Metalama.​Framework.​Services

Metalama.​Framework.​Utilities

Metalama.​Framework.​Validation

Extensions API

Patterns API

Flashtrace API

Introspection API

Advanced API

Post­Sharp API migration

  • Article

Class DeclarationExtensions

Extension methods for IDeclaration.

Inheritance
DeclarationExtensions
Namespace: Metalama.Framework.Code
Assembly: Metalama.Framework.dll
Syntax
[CompileTime]
public static class DeclarationExtensions

Methods

Name Description
ContainedChildren(IDeclaration)

Gets the declarations (namespaces, types, methods, properties, fields, constructors, events, indexers) directly contained in the given declaration.

ContainedDescendants(IDeclaration)

Gets the declarations (namespaces, types, methods, properties, fields, constructors, events, indexers) in the given declaration and in any child of the declaration.

ContainedDescendantsAndSelf(IDeclaration)

Gets the declarations (namespaces, types, methods, properties, fields, constructors, events, indexers) in the given declaration and in any child of the declaration, plus the given declaration.

ContainingAncestors(IDeclaration)

Gets all containing ancestors, i.e. declaration.ContainingDeclaration, declaration.ContainingDeclaration.ContainingDeclaration, declaration.ContainingDeclaration.ContainingDeclaration.ContainingDeclaration...

ContainingAncestorsAndSelf(IDeclaration)

Gets all containing ancestors including the current declaration, i.e. declaration, declaration.ContainingDeclaration, declaration.ContainingDeclaration.ContainingDeclaration, declaration.ContainingDeclaration.ContainingDeclaration.ContainingDeclaration...

Enhancements<T>(T)

Gets an object that gives access to the aspects, options and annotations on the current declaration.

ForCompilation<T>(T?, ICompilation)

Gets a representation of the current declaration in a different version of the compilation.

GetClosestMemberOrNamedType(IDeclaration)

Gets the declaring IMemberOrNamedType of a given declaration if the declaration if not an IMemberOrNamedType, or the IMemberOrNamedType itself if the given declaration is itself an IMemberOrNamedType.

GetClosestNamedType(IDeclaration)

Gets the declaring INamedType of a given declaration if the declaration is not an INamedType, or the INamedType itself if the given declaration is itself an INamedType.

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.

GetTopmostNamedType(IDeclaration)

Gets the topmost type of a nested type, i.e. a type that is not contained in any other type. If the given type is not a given type, returns the given type itself.

IsContainedIn(IDeclaration, IDeclaration)

Determines if a given declaration is a child of another given declaration, using the ContainingDeclaration relationship for all declarations except for named type, where the parent namespace is considered.

IsMemberKind(DeclarationKind)
IsRecordCopyConstructor(IConstructor)
TryForCompilation<T>(T?, ICompilation, out T?)

Tries to get a representation of the current declaration in a different version of the compilation.

  • Navigation