Reflection: Inspection of a Type's Metadata

The act of inspecting a type's metadata at runtime is called reflection, and it is a fundamental facility of the CLR. In fact, reflection is so fundamental that the type system's base class, System.Object, has a method GetType specifically designed to facilitate this inspection. The GetType method returns an object of type Type—a slightly unfortunate choice, as this overloading of the word type can sometimes prove confusing. To distinguish between the two usages, in this chapter the term type, with a lowercase t, normally means any type in the CLR, such as the Object or String type. The term Type, with a capital T, refers to the Type class provided by the Base Framework. The GetType() method returns ...

Get Programming in the .NET Environment 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.