【发布时间】:2017-10-09 02:15:52
【问题描述】:
我目前正在处理资源文件以翻译一些文本。
我有主要的“RevitString.resx”和“RevitString.fr-FR.resx”。 它们都有相同的键和翻译值,并且是公开的。
我想在我的 c# 代码中使用它们,代码如下:
ResourceSet resourceSet = Resources.Languages.Tables.RevitString.ResourceManager.GetResourceSet(CultureInfo.CurrentUICulture, true, true);
type = (from ResourceDictionary x
in resourceSet
where x.Keys.ToString() == _type.Definition.ParameterGroup.ToString()
select x.Values.ToString()).FirstOrDefault();
但是当我运行它时,我得到了一个空 ResourceSet,当我查看 ResourceManager 时,“ResourceSets”是空的,count = 0。
我做错了什么?
我已经看过一些帖子,比如this
谢谢!
【问题讨论】:
-
你测试过
where x.Keys.ToString() == "yourKey"看看它是否返回了什么? -
nvm,你的
resourceset计数为 0 -
@GibralterTop 是的,由于我的 count = 0,我也尝试过并且得到了一个 null execption :(
-
stackoverflow.com/q/39858236/5224021 也许这里有什么可以帮助的
-
@GibralterTop 它有效!谢谢你:)
标签: c#