Summary

Static type information is not always available. Objects may be obtained without static type information, requiring discovery of type information at runtime. Exploration of options to deal with such scenarios brought us to the wonderful world of reflection provided by the common language runtime.

After a brief detour through writing extensible applications, we approached dynamic programming from the angle of dynamic code generation. Starting with the .NET 2.0 story using lightweight code generation, we gradually moved into newer APIs that facilitate this kind of metaprogramming. In particular, we looked at the expression tree APIs that originate from LINQ in .NET 3.5 and have been extended in .NET 4 with support for statement nodes. ...

Get C# 4.0 Unleashed 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.