Open sandboxFocus

Class HierarchicalOptionsAttribute

Custom attribute that, when applied to a class implementing the IHierarchicalOptions interface, specifies how the options are inherited across different declaration levels.

Inheritance
HierarchicalOptionsAttribute
Namespace: Metalama.Framework.Options
Assembly: Metalama.Framework.dll
Syntax
[RunTimeOrCompileTime]
[AttributeUsage(AttributeTargets.Class)]
public sealed class HierarchicalOptionsAttribute : Attribute
Remarks

By default, hierarchical options are inherited along all axes: from base types to derived types, from base members to overriding members, from enclosing types to nested types, and from declaring types to their members. This attribute allows aspect authors to disable inheritance along specific axes when the default behavior is not appropriate for their options.

For example, an aspect might want options to be inherited from a type to its members, but not from a base type to derived types. This can be achieved by setting InheritedByDerivedTypes to false while leaving other properties as true.

Constructors

Name Description
HierarchicalOptionsAttribute()

Properties

Name Description
InheritedByDerivedTypes

Gets or sets a value indicating whether the options are inherited from the base type to derived types. The default value is true.

InheritedByMembers

Gets or sets a value indicating whether the options are inherited from the declaring type to its members. The default value is true.

InheritedByNestedTypes

Gets or sets a value indicating whether the options are inherited from the enclosing type to the nested types. The default value is true.

InheritedByOverridingMembers

Gets or sets a value indicating whether the options are inherited from the base virtual member to the overriding members. The default value is true.

Extension Methods

See Also