感到困惑的资源和GetManifestResourceNames() [英] confused about resources and GetManifestResourceNames()

查看:445
本文介绍了感到困惑的资源和GetManifestResourceNames()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在学习在C#和Visual C#IDE资源。我现在很困惑。我已阅读StackOverflow的一些网页,像这样的how-to-得到最路径的-AN-embebbed资源和微软的文档,但我弄糊涂了。

I've been learning about resources in C# and the visual C# IDE. I'm confused now. I have read some pages on StackOverflow, like this one how-to-get-the-path-of-an-embebbed-resource and the documentation of Microsoft, but it confused me.

我的第一个问题:什么是资源:是.resources文件或者是它是在它里面,像图标的文件

My first question: what are resources: is it the .resources file or is it the files that are inside it, like icons.

第二:当我使用方法GetManifestResourceNames:我拿到的.resources文件名称或它里面的文件的名称。当我在程序中使用它,我只得到的.resources文件,但是像这样的环通,所有的资源-IN-A-RESX文件阅读的话题,我得到的印象是我应该得到的名称.resources文件中的文件。

second: When I use the GetManifestResourceNames method: do I get the .resources files names or the the names of the files inside it. When I use it in my program, I only get the .resources files, but reading topics like this loop-through-all-the-resources-in-a-resx-file , I get the impression I should get the names of the files inside the .resources file.

是我,或者是这个术语实在是有点混乱?任何人都可以使它更清晰一点?感谢所有帮助。

Is it me, or is this terminology really a bit confusing? Can anyone make it a little clearer? Thanks for all help.

推荐答案

资源是你通过标记它作为一个EmbeddedResource这只是合并文件到编译的任何文件装配。 GetManifestResourceNames()仅仅是一个枚举,让我们所有的嵌入式编译资源文件的名称,例如 MyAssembly.resources 。实际的资源要素需要通过的ResourceSet 其中加载该文件的资源

Resources are any file you compile by flagging it as an "EmbeddedResource" this simply merge the file into the assembly. GetManifestResourceNames() is just an enumerator that give us the name of all embedded compiled resources files, e.g. MyAssembly.resources. The actual resource elements need to be enumerated via a ResourceSet which loads this resources file.

这篇关于感到困惑的资源和GetManifestResourceNames()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆