AttributeUsageAttribute Constructor

AttributeUsageAttribute Constructor (AttributeTargets)


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

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

public AttributeUsageAttribute(
	AttributeTargets validOn


Type: System.AttributeTargets

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

You can combine several AttributeTargets values using a bitwise OR operation to get the desired combination of valid program elements.

For default property values, see the ValidOn, AllowMultiple, and Inherited properties.

The definition of the DispId attribute illustrates the use of a bitwise OR operation to combine several AttributeTargets values.

namespace System.Runtime.InteropServices
   [AttributeUsage(AttributeTargets.Method | AttributeTargets.Field |
   public class DispIdAttribute: System.Attribute
      public DispIdAttribute(int value) {
        // . . .

      public int Value {
         get {
            // . . .
            return 0;

Universal Windows Platform
Available since 4.5
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top
© 2015 Microsoft