gpt4 book ai didi

c# - 在 AppResources 中使用字符串

转载 作者:太空狗 更新时间:2023-10-30 00:51:56 25 4
gpt4 key购买 nike

我正在使用 LocalizedResources 为我的 WP 8.1 应用程序获取本地化。但是如果我使用这样的代码:

protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
string xyz = string.Empty;
NavigationContext.QueryString.TryGetValue("znam", out xyz);
tekstZnamenitosti.Text = AppResources.tekstTrsat;
}

然后我将不得不有许多 if 语句来检查每个 znamenitost。有没有办法使用

tekstZnamenitosti.Text = AppResources.xyz;

其中 xyz 是我之前制作的字符串,其中是从我导航的页面传递的值。

最佳答案

您可以使用 ResourceManager 获取 AppResources 值:

tekstZnamenitosti.Text = AppResources.ResourceManager.GetString("xyz");

关于c# - 在 AppResources 中使用字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24258033/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com