Working with reflection and attributes
Reflection is a programming feature that allows code to understand and manipulate itself. An assembly is made up of up to four parts:
- Assembly metadata and manifest: Name, assembly, file version, referenced assemblies, and so on.
- Type metadata: Information about the types, their members, and so on.
- IL code: Implementation of methods, properties, constructors, and so on.
- Embedded resources (optional): Images, strings, JavaScript, and so on.
The metadata comprises items of information about your code. The metadata is generated automatically from your code (for example, information about the types and members) or applied to your code using attributes.
Attributes can be applied at multiple levels: to assemblies, to types, and to their members, as shown in the following code:
// an assembly-level attribute
[assembly: AssemblyTitle("Working with reflection and attributes")]
// a type-level attribute...