开发者

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:

  1. 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.
  2. 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.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜