Skip to content

Latest commit

 

History

History
11 lines (6 loc) · 1.69 KB

ii.5.9-attributes-and-metadata.md

File metadata and controls

11 lines (6 loc) · 1.69 KB

II.5.9 Attributes and metadata

Attributes of types and their members attach descriptive information to their definition. The most common attributes are predefined and have a specific encoding in the metadata associated with them (§II.23). In addition, the metadata provides a way of attaching user-defined attributes to metadata, using several different encodings.

From a syntactic point of view, there are several ways for specifying attributes in ILAsm:

  • Using special syntax built into ILAsm. For example, the keyword private in a ClassAttr specifies that the visibility attribute on a type shall be set to allow access only within the defining assembly.

  • Using a general-purpose syntax in ILAsm. The non-terminal CustomDecl describes this grammar (§II.21). For some attributes, called pseudo-custom attributes, this grammar actually results in setting special encodings within the metadata (§II.21.2.1).

  • Security attributes are treated specially. There is special syntax in ILAsm that allows the XML representing security attributes to be described directly (§II.20). While all other attributes defined either in the standard library or by user-provided extension are encoded in the metadata using one common mechanism described in §II.22.10, security attributes (distinguished by the fact that they inherit, directly or indirectly from System.Security.Permissions.SecurityAttribute, see Partition IV) shall be encoded as described in §II.22.11.