9.1. Reflection

Reflection is one of the more powerful tools that developers can take advantage of as part of the .NET platform. As its name implies, reflection is meant to capture the set of functionality that allows clients to explore all the details about a data type. The most powerful aspect of reflection is its ability to allow programmers to use late-binding to create types on-the-fly at run-time. Developers leverage these reflection mechanisms as the backbone of a whole host of creative solutions.

As you can imagine, reflection is a fairly broad topic that is outside the scope of this book. At the same time, generics represent a fairly significant enhancement of the existing .NET type system and, as such, it's important for developers to understand how to provide specific insight into inspecting, creating, and manipulating generic types via the reflection APIs. Generics definitely throw some new concepts into the mix. The sections that follow explore each of these generic constructs in detail.

9.1.1. Working with Open and Closed Types

The interfaces for creating, inspecting, and manipulating generic types are loosely divided into those that operate on open types and those that operate on closed types. Chapter 1, "Generics 101," talked about how open types were the conceptual equivalent of a class, whereas closed types could be viewed as objects that are instances of those open types. It's helpful to keep this conceptual view in mind as you look at the reflection interfaces ...

Get Professional .NET 2.0 Generics 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.