ECMA-334: 24. Attributes

Microsoft .NET Framework, ASP.NET, Visual C# (CSharp, C Sharp, C-Sharp) Developer Training, Visual Studio


Jump to: navigation, search
C# Language Specification
© 2006 ECMA International

24. Attributes

[Note: Much of the C# language enables the programmer to specify declarative information about the entities defined in the program. For example, the accessibility of a method in a class is specified by decorating it with the method-modifiers public, protected, internal, and private. end note]

C# enables programmers to invent new kinds of declarative information, called attributes. Programmers can then attach attributes to various program entities, and retrieve attribute information in a run-time environment. [Note: For instance, a framework might define a HelpAttribute attribute that can be placed on certain program entities (such as classes and methods) to provide a mapping from those program entities to their documentation. end note]

Attributes are defined through the declaration of attribute classes (§24.1), which can have positional and named parameters (§24.1.2). Attributes are associated with program entities using attribute specifications (§24.2), and can be retrieved at run-time as attribute instances (§24.3).


Today's Deals: Electronics

Personal tools