Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

People very rarely rely on extra source code generation stages or preprocessors in C#. The Javascript ecosystem is dependent on them because Javascript is the only language that's a first class citizen in the browser. You can also do some pretty expressive things in C# with LINQ, expression trees, reflection, and so on. You can even emit IL at runtime if you really need to.

https://learn.microsoft.com/en-us/dotnet/csharp/advanced-top...

The only C# generator I'm familiar with is for protobuf. I suppose the P/Invoke generators count too.



> You can even emit IL at runtime if you really need to.

I know, I already did that (generating mapping to industrial controllers from the config).

> The only C# generator I'm familiar with is for protobuf.

If you use .NET 6 you may use multiple source generator without knowing, it's very transparent.

For example, if you use System.Text.Json you may be using code generation.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: