Observing and Modifying Code Execution Dynamically
This chapter is about some common types that are included with .NET for performing code reflection and applying and reading attributes, working with expression trees, and creating source generators. These technologies enable a broad range of capabilities from code inspection and modification to runtime behavior alteration. This can significantly enhance the flexibility and efficiency of your applications.
Reflection is a powerful feature in .NET that allows programs to inspect and manipulate themselves. It can be used to access information about assemblies, modules, and types, and to dynamically create and invoke types and methods.
Expression trees represent code in a tree-like data structure, where each node is an expression, such as a method call or a binary operation. This feature can be used to inspect, modify, or execute code dynamically.
Introduced in .NET 5, source generators are a way to produce additional files...