Programming with Metadata

The previous section ended with an example that displayed a list of types a given object was compatible with. That example is just the tip of the iceberg of what is possible when type definitions are made machine-readable. This facility is often called reflection, a term made popular by Java.

Reflection makes all aspects of a type's definition available to programs, both at development time and at runtime. Although reflection is useful for building highly dynamic systems, it is far more applicable as a development-time tool. The primary application for reflection is for code generation. Code generation is typically thought of as a development-time activity, and reflection is useful in this capacity. However, even systems ...

Get Essential .NET, Volume 1: The Common Language Runtime now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.