Hacker News new | ask | show | jobs
by Pxtl 3331 days ago
Agreed. I code in C# and there's facility for bundling assets into the binary but they're handled at the project file level and not the C# file level, and this means the keys to access this binary content is not available as a compile-time constant. You're still just passing strings around and hoping they match.

Having first-class language support for resource files looks fantastic.

2 comments

> and this means the keys to access this binary content is not available as a compile-time constant

Isn't that exactly what resource files give you or am I confusing something? Anything you add in resource files have are accessible as a static variable.

It looks like you're right (for C# at least): https://msdn.microsoft.com/en-us/library/7k989cfy(v=vs.90).a...
I wonder how XNA's asset pipelines worked. I also wonder if you could "pack" a binary into an assembly by writing a tiny bit of IL around it.
Yeah, that's the workflow I was mentioning, cooking the file into a resource by referencing it as resource in the csproj, but then it's keyed by a string of the file-path within the project file, which isn't nearly as nice as having it bound to a variable in C#.