4

Reasoning about Types Using Reflection

Now that we have covered some of the basics of how metaprogramming can benefit you, its core concepts, and a real-world example, it’s time to look inside the .NET runtime and see how we can leverage its power.

In this chapter, we will have a look at the implicit metadata provided by the compiler and the runtime. We’ll see how we can collect all types in a running system and use it for discovery.

We will cover the following topics:

  • Assembly discovery in the running process
  • Leveraging library metadata to get project-referenced assemblies
  • Discovering types
  • Open/closed principle applied

By the end of this chapter, you will understand how you can use the powerful APIs of the .NET runtime to reason about ...

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