source generator

A compiler plug-in that writes extra C# code during the build, based on the code you wrote.

In more detail

Generated code is compiled together with your code, so errors appear at build time. Mapperly and System.Text.Json use source generators to replace run-time reflection with ordinary compiled code that the compiler checks.

Related terms

Taught in

References