Reflection

At the heart of dynamic programming facilities, we find various services provided by the runtime, one of which is reflection. The goal of this service provided by the CLR and exposed through the Base Class Library (BCL) is to allow you to inspect the characteristics of types, their members, and their containers (assemblies and modules). As you will see later, reflection has additional capabilities that have to do with code generation. Figure 21.3 shows the relationship between instances, types, and the reflection data associated with a type.

Image

FIGURE 21.3 Reflecting on an object’s type produces an object of type System.Type.

Get C# 5.0 Unleashed now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.