2010-04-20 45 views

回答

4

您可以使用ResourceSet ResourceManager.GetResourceSet( CultureInfo culture, bool createIfNotExists, bool tryParents)

例子:

ResourceManager resman = new ResourceManager(); 
CultureInfo culinfo = new CultureInfo("RU-ru"); 
if(resman.GetResourceSet(culinfo, false, false) == null) 
{ 
    Console.WriteLine("Resource file for culture \"RU-ru\" does not exist."); 
} 
+0

我试过你provieded的代码,但它不工作。这里是我的资源文件的一些详细信息: 我有两个资源文件中定义 Resources.resx(+了.Designer.cs) Resources.de.resx 我使用由资源类 resman提供的ResourceManager .GetResourceSet(new CultureInfo(“de-DE”),false,false)尽管我已经为geman语言定义了一个资源。 考虑看看ResourceManager的实例表明,有定义了三个ResourceSets: - {}恩 - {} - {EN-US} 但没有对的ResourceSet定义 '去-DE'。 我在做什么错? – crauscher 2010-04-20 12:54:33

+0

嗯,请检查您的资源文件是否编译为资源dll? – Kaerber 2010-04-27 09:05:33