Name
AttributeUsage Attribute
Class
System.AttributeUsageAttribute
Applies to
Class
Description
Defines the program elements to which a custom attribute can be applied. Its use is required when defining a custom attribute.
Constructor
New(validOn
)
-
validOn
(System.AttributeTargets
) Indicates the program elements to which a custom attribute can be applied. Possible values are
All
,Assembly
,Class
,Constructor
,Delegate
,Enum
,Event
,Field
,Interface
,Struct
,Method
,Module
,Parameter
,Property
, andReturnValue
.
Properties
- AllowMultiple (Boolean)
Indicates whether the attribute can be used more than once on a single program element. Its default value is
False
.- Inherited (Boolean)
Indicates whether attribute is automatically inherited by derived classes and overridden members. Its default value is
True
.- ValidOn (
AttributeTargets
enumeration) Read-only. Indicates the program elements to which the attribute can be applied. Its value is set by the required
validon
parameter of the class constructor.
Example
See Section 8.2 in Chapter 8 for more details and an example.
Get VB.NET Language in a Nutshell, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.