System.Type

One of the main entry points to the reflection data is the System.Type type, which can be obtained through a variety of ways, one of which is the typeof operator in C#:

var stringType = typeof(string);var intType = typeof(int);

Both of those objects are of type System.Type (that is, you could substitute both uses of var with Type) and contain information about the capabilities of the said type. The uses of typeof in the preceding code translate into two instructions that map a token, which can be seen as a type name the runtime can look up in various data structures, onto the runtime object representing the type:

ldtoken   [mscorlib]System.Int32call      class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle( ...

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.