AttributeUsageAttribute Constructor

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
)

Parameters

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.


[AttributeUsage(AttributeTargets.Method | AttributeTargets.Field |
AttributeTargets.Property)]
public class DispIdAttribute : System.Attribute
{
  public DispIdAttribute(int value)
  {
     // . . .
  }

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


Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show: