C# has an interesting concept of second-class macros called Source Generators: https://devblogs.microsoft.com/dotnet/introducing-c-source-generators/ You can generate additional code at build time, but you can't transform existing expressions (unlike normal macros), so it's more amenable to tooling.