Re:Comptime – C# meta-programming with compile-time code gen...
by floucky on Thursday December 25, 2025 @09:12AM
(#46384512)
Can't you already do that with embedded resources?
[ Parent
| on HN ]
Re:Comptime – C# meta-programming with compile-time code gen...
by andix on Thursday December 25, 2025 @09:17AM
(#46384546)
Yes, you can. But it's a bit cumbersome. The API to read them is not really intuitive, they are only accessible as a Stream, so they need to be either read every time into a string (new allocation, slow), or you need a helper that reads them once and keeps them in memory. I think there are also a lot of gotchas around naming and listing them.
In modern code I don't see them that often anymore.
Re:Comptime – C# meta-programming with compile-time code gen...
by orphea on Thursday December 25, 2025 @10:55AM
(#46385113)
I see your point and I don't necessarily disagree but better API for embedded resources is just a couple of simple extension methods away. I wouldn't even bother adding an external package for it.