Difference between having resources in Resx file and folder
I know I can add resources to Resources.resx file an开发者_如何学JAVAd then use it like properties.resources.MyFile.dat.
But what is the difference when I simply add file to Resources folder (setting it to embedded) and Copy to output dir to Always copy and access it like "\Resources\Data\file.dat"? Also this is another way how to add resources?There are two core differences:
- When you have your resources inside a .resources file, they are normally embedded on your assembly (the
.exe
or.dll
file) instead of having their own file. - When the resource is embedded on your assembly, you can rely on the .Net Framework's localization infrastructure to have localized versions of it if the need arises.
In summary:
- For resources you'll need to localize, embed.
- For resources you'll need to change from the program, use stand-alone files.
- For everything else, it's just a matter of taste.
精彩评论