Open sandboxFocus

Property Id

Id

Gets or sets an identifier that can be used to reference this template from advising methods.

Declaration
public string? Id { get; set; }
Property Value
Type Description
string
Remarks

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

When not set, templates can only be referenced by their member name using nameof(TemplateMember).