Home C# Querying Metadata with Reflection

C# - Querying Metadata with Reflection


In tutorial 2, "Introducing Microsoft .NET," I touched on the fact that the compiler generates a Win32-portable executable (PE) comprising mainly MSIL and metadata. One very powerful feature of .NET is that it allows you to write code to access an application's metadata through a process known as reflection. Put simply, reflection is the ability to discover type information at run time. This tutorial will describe the reflection API and how you can use it to iterate through an assembly's modules and types and to retrieve the different design-time characteristics of a type. You'll also see several advanced usages of reflection, such as dynamically invoking methods and use type information (through late binding) and even creating and executing MSIL code at run time!

[Next]