Custom attribute that determines the usage of a MulticastAttribute.
Namespace: PostSharp.Extensibility
Assembly: PostSharp.dll
Syntax
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
public sealed class MulticastAttributeUsageAttribute : AttributeRemarks
This attribute is the equivalent of AttributeUsageAttribute for multicast attributes. The aspect developer uses it to
define the valid targets of the attribute and the filters applied during multicasting. Aspect users can restrict these targets with the
properties of MulticastAttribute whose name starts with Attribute, but cannot enlarge them.
Every multicast attribute class, or one of its base classes, must have this attribute; otherwise PostSharp reports a build error. The attribute is inherited. A derived class can override it, but only to restrict the set of valid targets: enabling AllowMultiple or AllowExternalAssemblies, or adding kinds to ValidOn, when a base class disallows them is a build error.
For validation rules that multicast filters cannot express, override CompileTimeValidate(object) or implement IValidableAnnotation.
Constructors
| Name | Description |
|---|---|
| MulticastAttributeUsageAttribute() | Initializes a new instance of the MulticastAttributeUsageAttribute class. |
| MulticastAttributeUsageAttribute(MulticastTargets) | Initializes a new instance of the MulticastAttributeUsageAttribute class. |
Properties
| Name | Description |
|---|---|
| AllowExtensionBlockMembers | Gets or sets a value indicating whether C# 14 extension block members are allowed. |
| AllowExternalAssemblies | Gets or sets a value indicating whether this attribute can be applied to declarations of external assemblies (that is, to assemblies other than the one in which the custom attribute is instantiated). |
| AllowMultiple | Gets or sets a value indicating whether multiple instances of the custom attribute are allowed on a single declaration. |
| Inheritance | Gets or sets how the custom attribute is inherited along the lines of inheritance of the target element. |
| PersistMetaData | Gets or sets a value indicating whether the custom attribute should be persisted in metadata, so that
it is available for |
| TargetExternalMemberAttributes | Gets or sets the attributes of the members (fields or methods) to which the custom attribute can be applied, when the members are external to the current module. |
| TargetExternalTypeAttributes | Gets or sets the attributes of the types to which the custom attribute can be applied, when the type is external to the current module. If the custom attribute relates to fields or methods, this property specifies which attributes of the declaring type are acceptable. |
| TargetMemberAttributes | Gets or sets the attributes of the members (fields or methods) to which the custom attribute can be applied. |
| TargetParameterAttributes | Gets or sets the attributes of the parameter to which the custom attribute can be applied. |
| TargetTypeAttributes | Gets or sets the attributes of the types to which the custom attribute can be applied. Visibility, scope (Instance or Static) and generation are the only categories that are taken into account; attributes of other categories are ignored. If the custom attribute relates to fields or methods, this property specifies which attributes of the declaring type are acceptable. |
| ValidOn | Gets the kinds of targets that instances of the related MulticastAttribute apply to. |