AttributeTarget CLASS

The target an attribute can apply to. These constants can be bitwise-OR'ed to create a value for multiple targets.

// This attribute can target both method and class declaration.
[AttributeType(target = AttributeTarget.METHOD | AttributeTarget.CLASS]
attribute DeclAttribute { }

Parent Class

All Members


TypeNameSignature
field S CCLASSpublic static const int CLASS
field S CATTRIBUTEpublic static const int ATTRIBUTE
field S CENUMpublic static const int ENUM
field S CMETHODpublic static const int METHOD
field S CFIELDpublic static const int FIELD
field S CCONSTRUCTORpublic static const int CONSTRUCTOR

Fields


public static const int CLASS

The attribute may only be applied at a class type declaration. Of particular note, this excludes interface, attribute and enum types.


public static const int ATTRIBUTE

The attribute may only be applied at an attribute type declaration. Such attribute is also known as meta-attribute.


public static const int ENUM

The attribute may only be applied at an enum type declaration.


public static const int METHOD

The attribute may only be applied at a method declaration that occurs in either class or interface.


public static const int FIELD

The attribute may only be applied at a field declaration that occurs in either class or attribute.


public static const int CONSTRUCTOR

The attribute may only be applied at a constructor declaration that occurs in a class.