Open sandboxFocus

Class InterfaceMemberAttribute

Marks a member in an aspect class as a template for implementing an interface member.

Inheritance
InterfaceMemberAttribute
Namespace: Metalama.Framework.Aspects
Assembly: Metalama.Framework.dll
Syntax
[AttributeUsage(AttributeTargets.Method|AttributeTargets.Property|AttributeTargets.Field|AttributeTargets.Event)]
public sealed class InterfaceMemberAttribute : TemplateAttribute, ITemplateAttribute, IAdviceAttribute
Remarks

Use this attribute on methods, properties, fields, or events in your aspect class that should implement members of an interface being added via ImplementInterface(IAdviser<INamedType>, INamedType, OverrideStrategy, object?).

Unlike IntroduceAttribute, members marked with [InterfaceMember] are only introduced when the corresponding ImplementInterface(IAdviser<INamedType>, INamedType, OverrideStrategy, object?) advice succeeds. If the advice is ignored (because the interface was already implemented and Ignore was used), the member is not introduced.

By default, an implicit (public) implementation is created. Set IsExplicit to true to create an explicit interface implementation instead.

Constructors

Name Description
InterfaceMemberAttribute()

Properties

Name Description
IsExplicit

Gets or sets a value indicating whether the interface member should be introduced as an explicit implementation.

WhenExists

Gets or sets the strategy to use when an interface member conflicts with an existing class member.

Extension Methods

See Also