MulticastAttributes Enumeration |
Namespace: PostSharp.Extensibility
Assembly: PostSharp (in PostSharp.dll) Version: 6.5.21.0 (6.5.21.0)
[FlagsAttribute] public enum MulticastAttributes
Member name | Value | Description | |
---|---|---|---|
Default | 0 | Specifies that the set of target attributes is inherited from the parent custom attribute. | |
Private | 2 | Private (visible inside the current type). | |
Protected | 4 | Protected (visible inside derived types). | |
Internal | 8 | Internal (visible inside the current assembly). | |
InternalAndProtected | 16 | Internal and protected (visible inside derived types that are defined in the current assembly). | |
InternalOrProtected | 32 | Internal or protected (visible inside all derived types and in the current assembly). | |
Public | 64 | Public (visible everywhere). | |
AnyVisibility | 126 | Any visibility. | |
Static | 128 | Static scope. | |
Instance | 256 | Instance scope. | |
AnyScope | 384 | Any scope (Static | Instance). | |
Abstract | 512 | Abstract methods. | |
NonAbstract | 1024 | Concrete (non-abstract) methods. | |
AnyAbstraction | 1536 | Any abstraction (Abstract | NonAbstract). | |
Virtual | 2048 | Virtual methods. | |
NonVirtual | 4096 | Non-virtual methods. | |
AnyVirtuality | 6144 | Any virtuality (Virtual | NonVirtual). | |
Managed | 8192 | Managed code implementation. | |
NonManaged | 16384 | Non-managed code implementation (external or system). | |
AnyImplementation | 24576 | Any implementation (Managed | NonManaged). | |
Literal | 32768 | Literal fields. | |
NonLiteral | 65536 | Non-literal fields. | |
AnyLiterality | 98304 | Any field literality (Literal | NonLiteral). | |
InParameter | 131072 | Input parameters. | |
CompilerGenerated | 262144 | Compiler-generated code. | |
UserGenerated | 524288 | User-generated code (anything expected CompilerGenerated). | |
AnyGeneration | 786432 | Any code generation (CompilerGenerated | UserGenerated)l | |
OutParameter | 1048576 | Output (out in C#) parameters. | |
RefParameter | 2097152 | Input/Output (ref in C#) parameters. | |
AnyParameter | 3276800 | Any kind of parameter passing (InParameter | OutParameter | RefParameter). | |
All | 4194302 | All members. |
If you specify this in a MulticastAttributeUsageAttribute, then the annotated attribute can only be multicast to elements that have these attributes. For example, if you create an aspect and annotate it with [MulticastAttributeUsage(TargetMemberAttributes=MulticastAttributes.Protected)], then multicasting will never apply the aspect to any type member that isn't protected.
If you specify this in a property of MulticastAttribute, then that specific multicast will be even more narrowed just to elements that have these attributes. For example, if you annotate a class with the aspect from the previous paragraph with [MyAspect(TargetMemberAttributes=MulticastAttributes.Virtual)], then it will only apply to that class's members that are both protected and, for methods, virtual.
There are 8 categories of flags. If you specify at least one flag for a category, you narrow the multicast just to elements that have one of the flags you specified in the category. For example, if you specify Public | Protected, you multicast to elements that are public or protected, but not private. Their other attributes (such as whether they are instance or static) do not matter.
The categories are visibility (public, private, ...); scope (static or instance); abstraction (abstract or non-abstract); virtuality (virtual or non-virtual); implementation (managed or unmanaged); literality (literal or nonliteral); generation (compiler-generated or user-created); and parameter (in, ref, or out).
If a category doesn't make sense for an element, then specifying its flags will have no effect for that element. For example, if you narrow your multicast down to virtual elements, it will still apply to fields or types (which can't be virtual).