Export (0) Print
Expand All

AttributeUsage

Describes how a custom attribute class can be used.

[AttributeUsage(
   validon,
   AllowMultiple=allowmultiple,
   Inherited=inherited
)]

Parameters

validon
Specifies the language elements on which the attribute can be placed; a combination of AttributeTargets values. Default value is AttributeTargets.All.
allowmultiple (optional)
A bool; if true, the attribute is multiuse. Default is false (single-use).
inherited (optional)
A bool; if true, the attribute is inherited by derived classes. Default is false (not inherited).

Applies To

Class declarations.

Remarks

The AttributeUsage attribute is a single-use attribute. AttributeUsage is an alias for System.AttributeUsageAttribute.

Example

See the example in Retrieving Attribute Information.

See Also

C# Attributes | Attributes Tutorial

Show:
© 2015 Microsoft