Open sandboxFocus

Constructor TemplateAttributeProperties

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.

Declaration
public TemplateAttributeProperties(string? Name = null, Accessibility? Accessibility = null, bool? IsVirtual = null, bool? IsSealed = null, bool? IsRequired = null, bool? IsAbstract = null, bool? IsPartial = null, bool? IsExtern = null, string? Id = null)
Parameters
Type Name Description
string Name

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

Accessibility? Accessibility

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

bool? IsVirtual

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

bool? IsSealed

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

bool? IsRequired

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

bool? IsAbstract

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

bool? IsPartial

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

bool? IsExtern

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

string 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.

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.

See Also