Open sandboxFocus

Interface IMetaTarget

Provides access to the target declaration being transformed by an aspect template. Access via meta.Target in template code.

Namespace: Metalama.Framework.Aspects
Assembly: Metalama.Framework.dll
Syntax
[CompileTime]
[InternalImplement]
public interface IMetaTarget
Remarks

IMetaTarget exposes properties to access the specific declaration type being targeted by a template (e.g., method, property, field, event). Use these properties to interact with and reference the target declaration within template code.

For example, access meta.Target.Method in a method template to get the method being overridden, or meta.Target.FieldOrProperty in a property template to access the underlying field or property.

Properties

Name Description
Compilation

Gets the code model of the whole compilation.

Constructor

Gets the target constructor, or throws an exception if the advice does not target a constructor.

ContractDirection

Gets the direction of the contract for which the template is being expanded.

Declaration

Gets the target declaration.

Event

Gets the target event, or throws an exception if the advice does not target an event.

Expression

Gets the target field, property, or parameter as a unified IExpression, or throws an exception if the declaration does not implement IExpression.

ExtensionBlock

Gets the current extension block.

Field

Gets the target field, or throws an exception if the advice does not target a field.

FieldOrProperty

Gets the target field or property, or throws an exception if the advice does not target a field or a property.

FieldOrPropertyOrIndexer

Gets the target field or property or indexer, or throws an exception if the advice does not target a field or a property or an indexer.

Indexer

Gets the target indexer, or throws an exception if the advice does not target an indexer.

Member

Gets the target member (method, constructor, field, property or event, but not a nested type), or throws an exception if the advice does not target a member.

Method

Gets the target method, or the accessor if this is a template for a field, property or event, or throws an exception if the advice does not target a method or accessor.

MethodBase

Gets the target method or constructor, or the accessor if this is a template for a field, property or event, or throws an exception if the advice does not target a method, constructor or accessor.

Parameter

Gets the target parameter or throws an exception if the advice does not target a parameter.

Parameters

Gets the list of parameters of the current Method, Constructor, Property or Indexer or throws an exception if the advice does not target a method, constructor, property or indexer.

Project

Gets the project being compiled.

Property

Gets the target property, or throws an exception if the advice does not target a property.

Type

Gets the current type including the introductions of the current aspect type. If the current context is within an extension block, this property evaluates to the declaring type of the extension block.

Extension Methods

See Also