Find all embedded resources in another assembly

白昼怎懂夜的黑 提交于 2019-12-10 12:33:29

问题


I'm working on localization for my project. For this, I have a class which should load an embedded resource from another assembly, and then read out the strings.

But also I need to know which resource files this assembly contains. The number and which languages those are, is unknown.

So how do I find out how the ".resx" file in this assembly is named? Those all have the same scheme: "de-DE.resx", "en-US.resx", and so on.

I need to know how many of those files are contained in this assembly, and which languages they are.

I know that the ResourceManager has access to them, thus it should be possible to access this information programatically too...


回答1:


You should use GetManifestResourceNames method from Assembly class (msdn):

string[] resourceNames = this.GetType().Assembly.GetManifestResourceNames();
foreach(string resourceName in resourceNames)
{
    Console.WriteLine(resourceName);
}


来源:https://stackoverflow.com/questions/11377790/find-all-embedded-resources-in-another-assembly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!