BCL mscorlib [00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 ] 1.0.5000.0 2.0.0.0 4.0.0.0 This type is safe for multithreaded operations. System.Object System.Runtime.InteropServices._Attribute System.AttributeUsage(System.AttributeTargets.All) System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None) System.Runtime.InteropServices.ComDefaultInterface(typeof(System.Runtime.InteropServices._Attribute)) System.Runtime.InteropServices.ComVisible(true)

Serves as the base class for custom attributes.

All attributes, whether built-in or user-defined, derive directly or indirectly from . Attributes inherit certain default behaviors: the attribute might be associated with any target element (see ); might or might not be inherited by a derived element; and multiple instances might or might not be allowed on the same target element. These behaviors are specified using .

An attribute is an annotation that can be placed on an element of source code and used to store application-specific information at compile time. This information is stored in the metadata and can be accessed either during application execution, through a process known as reflection, or when another tool reads the metadata. Attributes might change the behavior of the application during execution, provide transaction information about an object, or convey organizational information to a designer.

The CLI predefines some attribute types and uses them to control runtime behavior. Some languages predefine attribute types to represent language features not directly represented in the Common Language Specification (CLS). User-defined attribute classes, inheriting from , can also be created. The definition of such a class includes the name of the attribute, its default behavior, and the information to be stored.

The following example creates and assigns multiple custom attributes to a class. The attribute contains the name of the programmer and the version number of the class.

`using System; [AttributeUsage(AttributeTargets.Class| AttributeTargets.Struct, AllowMultiple=true)] public class Author : Attribute { string authorName; public double verSion; public Author(string name) { authorName = name; verSion = 1.0; } public string getName() { return authorName; } } [Author("Some Author")] class FirstClass { /*...*/ } class SecondClass // no Author attribute { /*...*/ } [Author("Some Author"), Author("Some Other Author", verSion=1.1)] class ThirdClass { /*...*/ } class AuthorInfo { public static void Main() { PrintAuthorInfo(typeof(FirstClass)); PrintAuthorInfo(typeof(SecondClass)); PrintAuthorInfo(typeof(ThirdClass)); } public static void PrintAuthorInfo(Type type) { Console.WriteLine("Author information for {0}", type); Attribute[] attributeArray = Attribute.GetCustomAttributes(type); foreach(Attribute attrib in attributeArray) { if (attrib is Author) { Author author = (Author)attrib; Console.WriteLine(" {0}, version {1:f}", author.getName(), author.verSion); } } Console.WriteLine(); } }`

The output is

Author information for FirstClass

Some Author, version 1.00

Author information for SecondClass

Author information for ThirdClass

Some Author, version 1.00

Some Other Author, version 1.10

- Constructor

  Constructs a new instance of the class.

  To be added.
  0
  1.0.5000.0
  2.0.0.0
  4.0.0.0
- Method
  System.Boolean `` The to compare to the current instance. To be added.

  Determines whether the current instance and the specified represent the same type and value.

  A where indicates represents the same type and value as the current instance. If is a null reference or is not an instance of , returns .

  This method overrides .

  0
  1.0.5000.0
  2.0.0.0
  4.0.0.0
- Method
  System.Attribute `` `` A instance. The of the custom attribute for which to check.

  Returns an instance of a specified custom attribute if a single instance of the attribute is in the metadata for the specified assembly.

  The single instance of of type that is applied to Returns if the specified attribute was not found.

  If multiple instances of can be applied to , use .

  or is . is not a type derived from . More than one instance of the specified custom attribute was found. 1 RuntimeInfrastructure Reflection 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Attribute `` `` An instance of a type derived from that describes a type member. The of the custom attribute for which to check.

  Returns an instance of a specified custom attribute if a single instance of the attribute is in the metadata for the specified member.

  The single instance of of type that is applied to Returns if the specified attribute was not found.

  If multiple instances of can be applied to , use .

  or is . is not a type derived from . does not represent a constructor, method, property, event, type, or field member. More than one instance of the specified custom attribute was found. 1 Reflection 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Attribute `` `` A instance. The of the custom attribute for which to check.

  Returns an instance of a specified custom attribute if a single instance of the attribute is in the metadata for the specified module.

  The single instance of of type that is applied to Returns if the specified attribute was not found.

  If multiple instances of can be applied to , use .

  or is . is not a type derived from . More than one instance of the specified custom attribute was found. 1 Reflection 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Attribute `` `` A instance. The of the custom attribute for which to check.

  Returns an instance of a specified custom attribute if a single instance of the attribute is in the metadata for the specified parameter.

  The single instance of of type that is applied to Returns if the specified attribute was not found.

  If multiple instances of can be applied to , use .

  or is . is not a type derived from . More than one instance of the specified custom attribute was found. 1 Reflection 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Attribute `` `` `` To be added. To be added. To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Attribute `` `` `` To be added. To be added. To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Attribute `` `` `` To be added. To be added. To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Attribute `` `` `` To be added. To be added. To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Attribute[] `` A instance.

  Returns an array of all custom attributes in the metadata for the specified assembly.

  A array containing all custom attributes that are applied to The array includes any inherited custom attributes. Returns an empty array if no custom attributes were found in the metadata for .

  To be added. is . 1 RuntimeInfrastructure Reflection 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Attribute[] `` An instance of a type derived from that describes a type member.

  Returns an array of all custom attributes in the metadata for the specified member.

  A array containing all custom attributes that are applied to The array includes custom attributes that are inherited by , if any. Returns an empty array if no custom attributes were found in the metadata for .

  To be added. is . does not represent a constructor, method, property, event, type, or field member. 1 Reflection 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Attribute[] `` A instance.

  Returns an array of all custom attributes in the metadata for the specified module.

  A array containing all custom attributes that are applied to The array includes any inherited custom attributes. Returns an empty array if no custom attributes were found in the metadata for .

  To be added. is . 1 Reflection 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Attribute[] `` A instance.

  Returns an array of all custom attributes in the metadata for the specified parameter.

  A array containing all custom attributes that are applied to The array includes any inherited custom attributes. Returns an empty array if no custom attributes were found in the metadata for .

  To be added. is . 1 Reflection 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Attribute[] `` `` To be added. To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Attribute[] `` `` A instance. The of the custom attribute for which to check.

  Returns an array of the instances of a specified custom attribute if the attribute is in the metadata for the specified assembly.

  An array of type containing the instances that are applied to The array includes any inherited instances of . Returns an empty array if the specified attribute was not found.

  To be added. or is . is not a type derived from . 1 RuntimeInfrastructure Reflection 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Attribute[] `` `` To be added. To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Attribute[] `` `` An instance of a type derived from that describes a type member. The of the custom attribute for which to check.

  Returns an array of the instances of a specified custom attribute if the attribute is in the metadata for the specified member.

  An array of type containing the instances that are applied to The array includes instances of that are inherited by , if any. Returns an empty array if the specified attribute was not found.

  To be added. or is . is not a type derived from . does not represent a constructor, method, property, event, type, or field member. 1 Reflection 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Attribute[] `` `` To be added. To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Attribute[] `` `` A instance. The of the custom attribute for which to check.

  Returns an array of the instances of a specified custom attribute if the attribute is in the metadata for the specified module.

  An array of type containing the instances that are applied to The array includes any inherited instances of . Returns an empty array if the specified attribute was not found.

  To be added. or is . is not a type derived from . 1 Reflection 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Attribute[] `` `` To be added. To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Attribute[] `` `` A instance. The of the custom attribute for which to check.

  Returns an array of the instances of a specified custom attribute if the attribute is in the metadata for the specified parameter.

  An array of type containing the instances that are applied to The array includes any inherited instances of . Returns an empty array if the specified attribute was not found.

  If represents a method parameter, the array returned by includes any instances for the parameter in the base methods.

  or is . is not a type derived from . 1 Reflection 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Attribute[] `` `` `` To be added. To be added. To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Attribute[] `` `` `` To be added. To be added. To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Attribute[] `` `` `` To be added. To be added. To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Attribute[] `` `` `` To be added. To be added. To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Int32

  Generates a hash code for the current instance.

  A containing the hash code for the current instance.

  The algorithm used to generate the hash code is unspecified.

  This method overrides .

  0
  1.0.5000.0
  2.0.0.0
  4.0.0.0
- Method
  System.Boolean To be added. To be added. To be added. 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Boolean `` `` A instance. The of the custom attribute for which to check.

  Returns a value indicating whether a specified custom attribute is present in the metadata for the specified assembly.

  if a custom attribute of type is applied to ; otherwise, .

  To be added. or is . is not derived from . 1 RuntimeInfrastructure Reflection 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Boolean `` `` An instance of a type derived from that describes a type member. The of the custom attribute for which to check.

  Returns a value indicating whether a specified custom attribute is present in the metadata for the specified member.

  if a custom attribute of type is applied to either directly or through inheritance; otherwise, .

  To be added. or is . is not derived from . is not a constructor, method, property, event, type, or field. 1 Reflection 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Boolean `` `` A instance. The of the custom attribute for which to check.

  Returns a value indicating whether a specified custom attribute is present in the metadata for the specified module.

  if a custom attribute of type is applied to ; otherwise, .

  To be added. or is . is not derived from . 1 Reflection 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Boolean `` `` A instance. The of the custom attribute for which to check.

  Returns a value indicating whether a specified custom attribute is present in the metadata for the specified parameter.

  if a custom attribute of type is applied to either directly or through inheritance; otherwise, .

  To be added. or is . is not derived from . 1 Reflection 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Boolean `` `` `` To be added. To be added. To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Boolean `` `` `` To be added. To be added. To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Boolean `` `` `` To be added. To be added. To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Boolean `` `` `` To be added. To be added. To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Boolean `` To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Void `` `` `` `` `` To be added. To be added. To be added. To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Void `` `` `` To be added. To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Void `` To be added. To be added. To be added. 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Void `` `` `` `` `` `` `` `` To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0 4.0.0.0
- Property
  System.Object To be added. To be added. To be added. 1.0.5000.0 2.0.0.0 4.0.0.0
0