Generating source code is not a new technology, and there are lots of different C# offerings out there available for you to use, or that you may in fact be using right now. Tools like PostSharp, Fody, CodeSmith, and many, many more. What is new however, with C# 9 and .NET 5, is a formal source generation offering from Microsoft. This takes advantage of a unique opportunity that only the Roslyn team can provide, that lets you run your generator inside the compiler pipeline, with access to the internal data structures the compiler produces. This presentation covers source generators in general, deep dives into the C# 9 offering, and then runs through some examples, talks about the possibilities, and will leave you with no shortage of ideas for your own generators that you can run wild with. When all you have is a hammer, everything looks like a nail, and with source generators in your tool belt, you won’t look at that slow old reflection code the same way ever again.
Video producer: https://ndcsydney.com/