Table of Contents

Class AttributeUsageAttribute

Namespace
System
Assembly
mscorlib.dll

Specifies the usage of another attribute class. This class cannot be inherited.

[AttributeUsage(AttributeTargets.Class)]
public sealed class AttributeUsageAttribute : Attribute
Inheritance
AttributeUsageAttribute
Inherited Members
Extension Methods

Constructors

AttributeUsageAttribute(AttributeTargets)

Initializes a new instance of the AttributeUsageAttribute class with the specified list of AttributeTargets, the AllowMultiple value, and the Inherited value.

public AttributeUsageAttribute(AttributeTargets validOn)

Parameters

validOn AttributeTargets

The set of values combined using a bitwise OR operation to indicate which program elements are valid.

Properties

AllowMultiple

Gets or sets a Boolean value indicating whether more than one instance of the indicated attribute can be specified for a single program element.

public bool AllowMultiple { get; set; }

Property Value

bool

true if more than one instance is allowed to be specified; otherwise, false. The default is false.

Inherited

Gets or sets a Boolean value that determines whether the indicated attribute is inherited by derived classes and overriding members.

public bool Inherited { get; set; }

Property Value

bool

true if the attribute can be inherited by derived classes and overriding members; otherwise, false. The default is true.

ValidOn

Gets a set of values identifying which program elements that the indicated attribute can be applied to.

public AttributeTargets ValidOn { get; }

Property Value

AttributeTargets

One or several AttributeTargets values. The default is All.