13.1 Type Hierarchy

Reflection involves traversing and manipulating an object model that represents an application, including all its compile-time and runtime elements. Consequently, it is important to understand the various logical units of a .NET application and their roles and relationships.

The fundamental units of an application are its types, which contain members and nested types. Types are contained in modules, which are composed into assemblies. All these elements are described with metadata. Metadata is generally produced by the compiler at compile time, although it may also be created on the fly via Reflection.Emit (which is described in the later section "Creating New Types at Runtime").

At runtime, these elements are all contained within an AppDomain. An AppDomain isn't described with metadata, yet it plays an important role in reflection because it forms a logical process that a .NET application runs in.

Each of these elements is exposed via a matching type from the System or System.Reflection namespaces. Figure 13-1 shows the inheritance hierarchy for key reflection types.

Figure 13-1. Inheritance relationships among the .NET reflection types

Given a reference to any of these elements, you can navigate the relationships between it and the related elements, as shown in Figure 13-2.

Figure 13-2. Traversing the .NET reflection hierarchy

    Part II: Programming with the .NET Framework
    Part IV: API Quick Reference