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 and 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
Metadata comprises of items of information about your code. Metadata is 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")] [Serializable] // a type-level attribute public class Person // a member-level attribute [Obsolete("Deprecated: use Run instead.")] public void Walk() { // ... }