The runtime code generation is a powerful practice that many developers are still reluctant to use. A typical, useful and simple point to start exploring the Expression Trees library is building a predicate (filter) or a math calculation. But Expression Trees is not the only library available. More recently the .NET world gained the ability to generate code using the compiler itself via APIs exposed by the Roslyn/CodeAnalisys libraries which allows, among many other things, parsing, visiting and generating the source code. During the session we will analyze practical use-cases, sometimes improving dramatically the performance of the app which will bring to the final dilemma of debugging the generated code, a task that is fundamental in real-life projects.
Raffaele Rialdi is a senior Software Architect working as a consultant, speaker and trainer. Since 2003, he is a Microsoft MVP in the Developer category. He is collaborating with many communities in the .NET and C++ space, and is the president of DotNetLiguria. He is currently working as an architect and developer on the backend of an enterprise project with a specific focus on code generation and working on cross-platform mobile and IoT development in both C# and C++ languages.