Custom attribute that, when applied on a method, event or property of an aspect class, specifies that this method, event or property should be introduced into the types to which the aspect is applied.
Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp.dll
Syntax
[AttributeUsage(AttributeTargets.Method|AttributeTargets.Property|AttributeTargets.Event, AllowMultiple = false)]
public sealed class IntroduceMemberAttribute : AdviceRemarks
Methods, properties and events annotated with IntroduceMemberAttribute must be public.
If the method, event or property is in a C# 8.0 nullable annotations context, its nullability information will be copied into the types as well.
Members are introduced by delegation: the introduced member calls the member of the aspect, where the implementation stays. For this reason, fields cannot be introduced; introduce a property instead. Use Visibility and IsVirtual to control the introduced member, and OverrideAction to choose what happens when the target type or a base type already defines the member.
Introduced members are not visible to the C# compiler in the project being built, so code of that project cannot call them directly.
Constructors
| Name | Description |
|---|---|
| IntroduceMemberAttribute() |
Properties
| Name | Description |
|---|---|
| IsIsVirtualSpecified | Gets a value indicating whether the IsVirtual property has been specified. |
| IsVirtual | Gets or sets a value indicating whether the introduced member should be virtual. |
| OverrideAction | Gets or sets the action to take when the member to be introduced already exists in the type to which the aspect is applied or in a base type. |
| Visibility | Gets or sets the visibility (Public, Family, ...) of the introduced member. |