Part 8 in a series on new language features in C# 12.

C# logo


This is an experimental feature that is disabled by default. It is an enhancement that source generators will be able to take advantage of. It allows source generators to modify (replace) existing code, rather than just adding new code.

Being an experimental feature, the implementation details are likely to change over time, and there’s no guarantee that it will necessarily ship as a regular feature in the future.

Further reading

Example source