本文介绍了使用ResourceLoader.GetString方法检索键中带点的资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用ResourceLoader.GetString从我的.resw文件中获取字符串资源.我可以检索键中没有点的资源,但是带点的资源会以空字符串的形式返回.例如:
I'm using ResourceLoader.GetString to get string resources from my .resw file. I'm able to retrieve resources without a dot in the key, but ones with a dot come back as an empty string. For example:
var rl = new Windows.ApplicationModel.Resources.ResourceLoader();
rl.GetString("HelpText"); // gets the string "Help"
rl.GetString("Forget.Text"); // gets "", even though it's defined in resw file as "Forgotten"
我尝试用其他各种字符替换点:
I've tried replacing the dot with various other characters:
rl.GetString("Forget_Text");
rl.GetString("Forget:Text");
rl.GetString("Forget-Text");
没有运气.MSDN上的所有示例都巧妙地避免提及此小问题,因此我有些困惑.有人可以帮忙吗?
No luck. All the examples on MSDN skilfully avoid mentioning this little issue, so I'm a bit stumped. Can anyone help?
推荐答案
实际上是通过正斜杠访问 的
It is actually accessed via a forward-slash:
rl.GetString("Forget/Text");
这篇关于使用ResourceLoader.GetString方法检索键中带点的资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!