AttributeUsage Attribute


AttributeUsage Attribute

Class

System.AttributeUsageAttribute

Applies To

Class

Constructor

     New(validOn) 


validOn (required; AttributeTargets enumeration)

Indicates the program elements to which a custom attribute can be applied. One of the following System.AttributeTargets enumeration values: All, Assembly, Class, Constructor, Delegate, Enum, Event, Field, Interface, Struct, Method, Module, Parameter, Property, or ReturnValue. Multiple values can be Or'd together to indicate an attribute to be used for many element types.

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 the attribute is automatically inherited by derived classes and overridden members. Its default value is true.


ValidOn (AttributeTargets enumeration)

Read-only. Value from the validOn constructor parameter.

Description

The <AttributeUsage> attribute defines the program elements to which a custom attribute can be applied. Its use is required when defining a custom attribute class.

Example

Chapter 9 discusses the use of the <AttributeUsage> attribute in the design of new custom attributes.




Visual Basic 2005(c) In a Nutshell
Visual Basic 2005 in a Nutshell (In a Nutshell (OReilly))
ISBN: 059610152X
EAN: 2147483647
Year: 2004
Pages: 712

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net