是否有优雅的方法来获取所需文化的所有字母? [英] Is there elegant way to get all letters of alphabet for desired culture?

查看:72
本文介绍了是否有优雅的方法来获取所需文化的所有字母?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获取给定CultureInfo的所有字母.我想避免这样的解决方案:
switch(cultureInfo.Name)
{
 案例我们":
 返回"ABCDEFG ...";
 案例"es":
   返回"ABCDEFG ...";
 案例"ru":
返回АБВГДЕЁЖ..."
  case ....
}

谢谢!

How to get all letters of alphabet for given CultureInfo. I'd like to avoid solution like:
switch(cultureInfo.Name)
{
  case "us":
    return "ABCDEFG...";
  case "es":
    return "ABCDEFG...";
  case "ru":
    return "АБВГДЕЁЖ..."
  case ....
}

Thanks!

推荐答案


为每种区域性添加资源文件,并从资源文件中读取字符串.

Hi,
Add resource file for each culture and read the strings from the resource file .

 Thread.CurrentThread.CurrentUICulture = new CultureInfo("fr-FR");
            ResourceManager LocRM = new ResourceManager("DgCombo.Resource", typeof(Form1).Assembly);            
            MessageBox.Show(LocRM.GetString("strMessage"));

有关资源文件的更多信息.
http://msdn.microsoft .com/zh-CN/library/y99d1cd3(VS.71).aspx

我希望它将对您有所帮助

more about resource file.
http://msdn.microsoft.com/en-us/library/y99d1cd3(VS.71).aspx

i hope it will help you


这篇关于是否有优雅的方法来获取所需文化的所有字母?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆