-
Book Overview & Buying
-
Table Of Contents
Metaprogramming in C#
By :
This chapter explored the dynamic realm of the .NET runtime and how you can take advantage of it to create dynamic types that have its types defined outside of C# code. When working with third parties through APIs, this approach can be very handy. If you look at REST APIs and the OpenAPI standard, you’ll see extensive use of JSON schemas, and marrying the approach in this chapter with such standards can provide you a powerful mechanism to dynamically integrate with third parties, and at the same time, you can be strict about the shape.
The DLR can be a powerful tool in your toolbox. It provides another approach to dynamically create types and code. Compared to generating intermediate language code, it can come across as more intuitive.
One of the downsides of the DLR is that the types generated can be hard to work with in a modern IDE or code editor, as it does not know about the types and can’t offer services such as IntelliSense for members.
Another...