Chapter 2. Exploring code and metadata with reflection

This chapter covers

  • The need for reflection
  • Reading metadata and executing code
  • Practical uses of reflection

Metaprogramming in .NET can incorporate many different concepts and techniques. Some areas are fairly easy to grasp, others can be quite difficult. The best way to begin is to visit the Reflection API, which has been in .NET since version 1. It provides a fairly simplistic introduction to core concepts of metaprogramming (such as introspection) and it gives you a glimpse into the structure of .NET code.

To start the journey down the .NET metaprogramming road, you’ll go through a couple of problems where reflection helps solve the issue. You’ll walk through examples that demonstrate ...

Get Metaprogramming in .NET 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.