Open sandboxFocus

Class TemplateAttributeProperties

Represents a set of properties that configure how a T# template member should be introduced into target code. These properties allow overriding the name, accessibility, and modifiers of members introduced from templates. When a property is null, its value is inherited from the template member itself.

Inheritance
TemplateAttributeProperties
Namespace: Metalama.Framework.Advising
Assembly: Metalama.Framework.dll
Syntax
[CompileTime]
public sealed record TemplateAttributeProperties : IEquatable<TemplateAttributeProperties>
Remarks

This record is used by ITemplateAttribute to store configuration properties for template members. It supports progressive enhancement of template attributes in future versions by encapsulating all configuration in a single object.

Constructors

Name Description
TemplateAttributeProperties(string?, Accessibility?, bool?, bool?, bool?, bool?, bool?, bool?, string?)

Represents a set of properties that configure how a T# template member should be introduced into target code. These properties allow overriding the name, accessibility, and modifiers of members introduced from templates. When a property is null, its value is inherited from the template member itself.

Properties

Name Description
Accessibility

The accessibility level of the introduced member (e.g., public, private, protected). When null, the accessibility is taken from the template member.

Id

An identifier that can be used to reference this template from advising methods. When set, this identifier can be passed to advising methods such as IntroduceMethod(IAdviser<INamedType>, string, IntroductionScope, OverrideStrategy, Action<IMethodBuilder>?, object?, object?) instead of the member name. This allows referencing templates by a stable identifier, which is useful when templates are defined in a separate assembly from the code that uses them.

IsAbstract

A value indicating whether the introduced member is abstract. When null, the value is taken from the template member.

IsExtern

A value indicating whether the introduced member is extern. When null, the value is taken from the template member.

IsPartial

A value indicating whether the introduced member is partial. When null, the value is taken from the template member.

IsRequired

A value indicating whether the introduced member is required (C# 11+ feature). When null, the value is taken from the template member.

IsSealed

A value indicating whether the introduced member is sealed. When null, the value is taken from the template member.

IsVirtual

A value indicating whether the introduced member is virtual. When null, the value is taken from the template member.

Name

The name of the introduced member. When null, the name is taken from the template member.

Methods

Name Description
Deconstruct(out string?, out Accessibility?, out bool?, out bool?, out bool?, out bool?, out bool?, out bool?, out string?)
Equals(TemplateAttributeProperties?)
Equals(object?)
GetHashCode()
ToString()

Operators

Name Description
operator ==(TemplateAttributeProperties?, TemplateAttributeProperties?)
operator !=(TemplateAttributeProperties?, TemplateAttributeProperties?)

Extension Methods

See Also