AttributeTargets Enumeration

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Specifies the application elements on which it is valid to apply an attribute.

This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

[SerializableAttribute]
[FlagsAttribute]
public enum AttributeTargets

Member nameDescription
AssemblyAttribute can be applied to an assembly.
ModuleAttribute can be applied to a module.
NoteNote
Module refers to a portable executable file (.dll or.exe) and not a Visual Basic standard module.
ClassAttribute can be applied to a class.
StructAttribute can be applied to a structure; that is, a value type.
EnumAttribute can be applied to an enumeration.
ConstructorAttribute can be applied to a constructor.
MethodAttribute can be applied to a method.
PropertyAttribute can be applied to a property.
FieldAttribute can be applied to a field.
EventAttribute can be applied to an event.
InterfaceAttribute can be applied to an interface.
ParameterAttribute can be applied to a parameter.
DelegateAttribute can be applied to a delegate.
ReturnValueAttribute can be applied to a return value.
AllAttribute can be applied to any application element.

The AttributeUsageAttribute class uses this enumeration to specify the kind of element on which it is valid to apply an attribute.

AttributeTargets enumeration values can be combined with a bitwise OR operation to get the preferred combination.

Show: